Comparing version 0.0.28 to 1.7.15-nightly-20240820.7
@@ -1,30 +0,46 @@ | ||
/* tslint:disable */ | ||
/* auto-generated by NAPI-RS */ | ||
/* eslint-disable */ | ||
/* auto-generated by NAPI-RS */ | ||
export interface Attribute { | ||
namespace?: string; | ||
prefix?: string; | ||
name: string; | ||
value?: string; | ||
} | ||
export interface Diagnostic { | ||
level: string | ||
message: string | ||
span: any | ||
level: string; | ||
message: string; | ||
span: any; | ||
} | ||
export interface Element { | ||
tagName: string; | ||
namespace: string; | ||
attributes: Array<Attribute>; | ||
isSelfClosing: boolean; | ||
} | ||
export declare function minify( | ||
code: Buffer, | ||
opts: Buffer, | ||
signal?: AbortSignal | undefined | null | ||
): Promise<TransformOutput>; | ||
export declare function minifyFragment( | ||
code: Buffer, | ||
opts: Buffer, | ||
signal?: AbortSignal | undefined | null | ||
): Promise<TransformOutput>; | ||
export declare function minifyFragmentSync( | ||
code: Buffer, | ||
opts: Buffer | ||
): TransformOutput; | ||
export declare function minifySync(code: Buffer, opts: Buffer): TransformOutput; | ||
export interface TransformOutput { | ||
code: string | ||
errors?: Array<Diagnostic> | ||
code: string; | ||
errors?: Array<Diagnostic>; | ||
} | ||
export interface Attribute { | ||
namespace?: string | ||
prefix?: string | ||
name: string | ||
value?: string | ||
} | ||
export interface Element { | ||
tagName: string | ||
namespace: string | ||
attributes: Array<Attribute> | ||
isSelfClosing: boolean | ||
} | ||
export function minify(code: Buffer, opts: Buffer, signal?: AbortSignal | undefined | null): Promise<TransformOutput> | ||
export function minifyFragment(code: Buffer, opts: Buffer, signal?: AbortSignal | undefined | null): Promise<TransformOutput> | ||
export function minifySync(code: Buffer, opts: Buffer): TransformOutput | ||
export function minifyFragmentSync(code: Buffer, opts: Buffer): TransformOutput |
533
binding.js
@@ -1,260 +0,347 @@ | ||
/* tslint:disable */ | ||
// prettier-ignore | ||
/* eslint-disable */ | ||
/* prettier-ignore */ | ||
/* auto-generated by NAPI-RS */ | ||
const { existsSync, readFileSync } = require('fs') | ||
const { join } = require('path') | ||
const { readFileSync } = require('fs') | ||
const { platform, arch } = process | ||
let nativeBinding = null; | ||
const loadErrors = []; | ||
let nativeBinding = null | ||
let localFileExisted = false | ||
let loadError = null | ||
const isMusl = () => { | ||
let musl = false; | ||
if (process.platform === "linux") { | ||
musl = isMuslFromFilesystem(); | ||
if (musl === null) { | ||
musl = isMuslFromReport(); | ||
} | ||
if (musl === null) { | ||
musl = isMuslFromChildProcess(); | ||
} | ||
} | ||
return musl; | ||
}; | ||
function isMusl() { | ||
// For Node 10 | ||
if (!process.report || typeof process.report.getReport !== 'function') { | ||
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-"); | ||
const isMuslFromFilesystem = () => { | ||
try { | ||
const lddPath = require('child_process').execSync('which ldd').toString().trim() | ||
return readFileSync(lddPath, 'utf8').includes('musl') | ||
} catch (e) { | ||
return true | ||
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl"); | ||
} catch { | ||
return null; | ||
} | ||
} 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 | ||
const isMuslFromReport = () => { | ||
const report = | ||
typeof process.report.getReport === "function" | ||
? process.report.getReport() | ||
: null; | ||
if (!report) { | ||
return null; | ||
} | ||
if (report.header && report.header.glibcVersionRuntime) { | ||
return false; | ||
} | ||
if (Array.isArray(report.sharedObjects)) { | ||
if (report.sharedObjects.some(isFileMusl)) { | ||
return true; | ||
} | ||
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 | ||
return false; | ||
}; | ||
const isMuslFromChildProcess = () => { | ||
try { | ||
return require("child_process") | ||
.execSync("ldd --version", { encoding: "utf8" }) | ||
.includes("musl"); | ||
} catch (e) { | ||
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false | ||
return false; | ||
} | ||
}; | ||
function requireNative() { | ||
if (process.platform === "android") { | ||
if (process.arch === "arm64") { | ||
try { | ||
return require("./swc-html.android-arm64.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-android-arm64"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else if (process.arch === "arm") { | ||
try { | ||
return require("./swc-html.android-arm-eabi.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-android-arm-eabi"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else { | ||
loadErrors.push( | ||
new Error(`Unsupported architecture on Android ${process.arch}`) | ||
); | ||
} | ||
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 | ||
} else if (process.platform === "win32") { | ||
if (process.arch === "x64") { | ||
try { | ||
return require("./swc-html.win32-x64-msvc.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-win32-x64-msvc"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else if (process.arch === "ia32") { | ||
try { | ||
return require("./swc-html.win32-ia32-msvc.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-win32-ia32-msvc"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else if (process.arch === "arm64") { | ||
try { | ||
return require("./swc-html.win32-arm64-msvc.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-win32-arm64-msvc"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else { | ||
loadErrors.push( | ||
new Error( | ||
`Unsupported architecture on Windows: ${process.arch}` | ||
) | ||
); | ||
} | ||
break | ||
case 'arm64': | ||
localFileExisted = existsSync( | ||
join(__dirname, 'html.win32-arm64-msvc.node') | ||
) | ||
} else if (process.platform === "darwin") { | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./html.win32-arm64-msvc.node') | ||
} else { | ||
nativeBinding = require('@swc/html-win32-arm64-msvc') | ||
} | ||
return require("./swc-html.darwin-universal.node"); | ||
} catch (e) { | ||
loadError = e | ||
loadErrors.push(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') | ||
} | ||
return require("@swc/html-darwin-universal"); | ||
} catch (e) { | ||
loadError = e | ||
loadErrors.push(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 | ||
if (process.arch === "x64") { | ||
try { | ||
return require("./swc-html.darwin-x64.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-darwin-x64"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else if (process.arch === "arm64") { | ||
try { | ||
return require("./swc-html.darwin-arm64.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-darwin-arm64"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else { | ||
loadErrors.push( | ||
new Error(`Unsupported architecture on macOS: ${process.arch}`) | ||
); | ||
} | ||
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') | ||
} else if (process.platform === "freebsd") { | ||
if (process.arch === "x64") { | ||
try { | ||
return require("./swc-html.freebsd-x64.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
try { | ||
return require("@swc/html-freebsd-x64"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else if (process.arch === "arm64") { | ||
try { | ||
return require("./swc-html.freebsd-arm64.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-freebsd-arm64"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else { | ||
localFileExisted = existsSync( | ||
join(__dirname, 'html.linux-x64-gnu.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./html.linux-x64-gnu.node') | ||
loadErrors.push( | ||
new Error( | ||
`Unsupported architecture on FreeBSD: ${process.arch}` | ||
) | ||
); | ||
} | ||
} else if (process.platform === "linux") { | ||
if (process.arch === "x64") { | ||
if (isMusl()) { | ||
try { | ||
return require("./swc-html.linux-x64-musl.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-linux-x64-musl"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else { | ||
nativeBinding = require('@swc/html-linux-x64-gnu') | ||
try { | ||
return require("./swc-html.linux-x64-gnu.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-linux-x64-gnu"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} | ||
} 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 if (process.arch === "arm64") { | ||
if (isMusl()) { | ||
try { | ||
return require("./swc-html.linux-arm64-musl.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-linux-arm64-musl"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else { | ||
nativeBinding = require('@swc/html-linux-arm64-musl') | ||
try { | ||
return require("./swc-html.linux-arm64-gnu.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-linux-arm64-gnu"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} | ||
} 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 if (process.arch === "arm") { | ||
try { | ||
return require("./swc-html.linux-arm-gnueabihf.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-linux-arm-gnueabihf"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else if (process.arch === "riscv64") { | ||
if (isMusl()) { | ||
try { | ||
return require("./swc-html.linux-riscv64-musl.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-linux-riscv64-musl"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else { | ||
nativeBinding = require('@swc/html-linux-arm64-gnu') | ||
try { | ||
return require("./swc-html.linux-riscv64-gnu.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-linux-riscv64-gnu"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
} else if (process.arch === "s390x") { | ||
try { | ||
return require("./swc-html.linux-s390x-gnu.node"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
try { | ||
return require("@swc/html-linux-s390x-gnu"); | ||
} catch (e) { | ||
loadErrors.push(e); | ||
} | ||
} else { | ||
loadErrors.push( | ||
new Error(`Unsupported architecture on Linux: ${process.arch}`) | ||
); | ||
} | ||
break | ||
case 'arm': | ||
localFileExisted = existsSync( | ||
join(__dirname, 'html.linux-arm-gnueabihf.node') | ||
) | ||
} else { | ||
loadErrors.push( | ||
new Error( | ||
`Unsupported OS: ${process.platform}, architecture: ${process.arch}` | ||
) | ||
); | ||
} | ||
} | ||
nativeBinding = requireNative(); | ||
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { | ||
try { | ||
nativeBinding = require("./swc-html.wasi.cjs"); | ||
} catch (err) { | ||
if (process.env.NAPI_RS_FORCE_WASI) { | ||
console.error(err); | ||
} | ||
} | ||
if (!nativeBinding) { | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./html.linux-arm-gnueabihf.node') | ||
} else { | ||
nativeBinding = require('@swc/html-linux-arm-gnueabihf') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
nativeBinding = require("@swc/html-wasm32-wasi"); | ||
} catch (err) { | ||
if (process.env.NAPI_RS_FORCE_WASI) { | ||
console.error(err); | ||
} | ||
} | ||
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`) | ||
if (loadErrors.length > 0) { | ||
// TODO Link to documentation with potential fixes | ||
// - The package owner could build/publish bindings for this arch | ||
// - The user may need to bundle the correct files | ||
// - The user may need to re-install node_modules to get new packages | ||
throw new Error("Failed to load native binding", { cause: loadErrors }); | ||
} | ||
throw new Error(`Failed to load native binding`); | ||
} | ||
const { minify, minifyFragment, minifySync, minifyFragmentSync } = nativeBinding | ||
module.exports.minify = minify | ||
module.exports.minifyFragment = minifyFragment | ||
module.exports.minifySync = minifySync | ||
module.exports.minifyFragmentSync = minifyFragmentSync | ||
module.exports.minify = nativeBinding.minify; | ||
module.exports.minifyFragment = nativeBinding.minifyFragment; | ||
module.exports.minifyFragmentSync = nativeBinding.minifyFragmentSync; | ||
module.exports.minifySync = nativeBinding.minifySync; |
92
index.ts
@@ -6,70 +6,70 @@ import * as binding from "./binding"; | ||
export type Options = { | ||
filename?: string; | ||
iframeSrcdoc?: boolean; | ||
scriptingEnabled?: boolean; | ||
forceSetHtml5Doctype?: boolean; | ||
collapseWhitespaces?: | ||
| "none" | ||
| "all" | ||
| "smart" | ||
| "conservative" | ||
| "advanced-conservative" | ||
| "only-metadata"; | ||
removeEmptyMetadataElements?: boolean; | ||
removeComments?: boolean; | ||
preserveComments: string[]; | ||
minifyConditionalComments?: boolean; | ||
removeEmptyAttributes?: boolean; | ||
removeRedundantAttributes?: boolean; | ||
collapseBooleanAttributes?: boolean; | ||
normalizeAttributes?: boolean; | ||
minifyJson?: boolean | { pretty?: boolean }; | ||
// TODO improve me after typing `@swc/css` | ||
minifyJs?: boolean | { parser?: any; minifier?: any; codegen?: any }; | ||
minifyCss?: boolean | { parser?: any; minifier?: any; codegen?: any }; | ||
minifyAdditionalScriptsContent?: [string, MinifierType][]; | ||
minifyAdditionalAttributes?: [string, MinifierType][]; | ||
sortSpaceSeparatedAttributeValues?: boolean; | ||
sortAttributes?: boolean; | ||
tagOmission?: boolean; | ||
selfClosingVoidElements?: boolean; | ||
quotes?: boolean; | ||
filename?: string; | ||
iframeSrcdoc?: boolean; | ||
scriptingEnabled?: boolean; | ||
forceSetHtml5Doctype?: boolean; | ||
collapseWhitespaces?: | ||
| "none" | ||
| "all" | ||
| "smart" | ||
| "conservative" | ||
| "advanced-conservative" | ||
| "only-metadata"; | ||
removeEmptyMetadataElements?: boolean; | ||
removeComments?: boolean; | ||
preserveComments: string[]; | ||
minifyConditionalComments?: boolean; | ||
removeEmptyAttributes?: boolean; | ||
removeRedundantAttributes?: boolean; | ||
collapseBooleanAttributes?: boolean; | ||
normalizeAttributes?: boolean; | ||
minifyJson?: boolean | { pretty?: boolean }; | ||
// TODO improve me after typing `@swc/css` | ||
minifyJs?: boolean | { parser?: any; minifier?: any; codegen?: any }; | ||
minifyCss?: boolean | { parser?: any; minifier?: any; codegen?: any }; | ||
minifyAdditionalScriptsContent?: [string, MinifierType][]; | ||
minifyAdditionalAttributes?: [string, MinifierType][]; | ||
sortSpaceSeparatedAttributeValues?: boolean; | ||
sortAttributes?: boolean; | ||
tagOmission?: boolean; | ||
selfClosingVoidElements?: boolean; | ||
quotes?: boolean; | ||
}; | ||
export type FragmentOptions = Options & { | ||
mode?: "no-quirks" | "limited-quirks" | "quirks"; | ||
context_element?: binding.Element; | ||
form_element?: binding.Element; | ||
mode?: "no-quirks" | "limited-quirks" | "quirks"; | ||
context_element?: binding.Element; | ||
form_element?: binding.Element; | ||
}; | ||
export async function minify( | ||
content: Buffer, | ||
options?: Options | ||
content: Buffer, | ||
options?: Options | ||
): Promise<binding.TransformOutput> { | ||
return binding.minify(content, toBuffer(options ?? {})); | ||
return binding.minify(content, toBuffer(options ?? {})); | ||
} | ||
export async function minifyFragment( | ||
content: Buffer, | ||
options?: FragmentOptions | ||
content: Buffer, | ||
options?: FragmentOptions | ||
): Promise<binding.TransformOutput> { | ||
return binding.minifyFragment(content, toBuffer(options ?? {})); | ||
return binding.minifyFragment(content, toBuffer(options ?? {})); | ||
} | ||
export function minifySync( | ||
content: Buffer, | ||
options?: Options | ||
content: Buffer, | ||
options?: Options | ||
): binding.TransformOutput { | ||
return binding.minifySync(content, toBuffer(options ?? {})); | ||
return binding.minifySync(content, toBuffer(options ?? {})); | ||
} | ||
export async function minifyFragmentSync( | ||
content: Buffer, | ||
options?: FragmentOptions | ||
content: Buffer, | ||
options?: FragmentOptions | ||
): Promise<binding.TransformOutput> { | ||
return binding.minifyFragmentSync(content, toBuffer(options ?? {})); | ||
return binding.minifyFragmentSync(content, toBuffer(options ?? {})); | ||
} | ||
function toBuffer(t: any): Buffer { | ||
return Buffer.from(JSON.stringify(t)); | ||
return Buffer.from(JSON.stringify(t)); | ||
} |
{ | ||
"name": "@swc/html", | ||
"packageManager": "yarn@3.2.3", | ||
"version": "0.0.28", | ||
"description": "Super-fast alternative for posthtml", | ||
"version": "1.7.15-nightly-20240820.7", | ||
"description": "Super-fast HTML minifier", | ||
"homepage": "https://swc.rs", | ||
@@ -25,3 +24,3 @@ "main": "./index.js", | ||
"napi": { | ||
"name": "html", | ||
"name": "swc-html", | ||
"triples": { | ||
@@ -49,7 +48,5 @@ "defaults": true, | ||
"prepublishOnly": "tsc -d && napi prepublish -p scripts/npm --tagstyle npm", | ||
"pack": "wasm-pack", | ||
"build:ts": "tsc -d", | ||
"build:wasm": "npm-run-all \"pack -- build ./crates/wasm --scope swc {1} -t {2} \" --", | ||
"build": "tsc -d && napi build --platform --cargo-name html_node --js ./binding.js --dts binding.d.ts -p html_node --release --cargo-cwd ../..", | ||
"build:dev": "tsc -d && napi build --platform --cargo-name html_node --js ./binding.js --dts binding.d.ts -p html_node --cargo-cwd ../..", | ||
"build": "tsc -d && napi build --manifest-path ../../bindings/Cargo.toml --platform -p binding_html_node --js ./binding.js --dts ./binding.d.ts --release -o .", | ||
"build:dev": "tsc -d && napi build --manifest-path ../../bindings/Cargo.toml --platform -p binding_html_node --js ./binding.js --dts ./binding.d.ts -o .", | ||
"test": "echo 'done!'", | ||
@@ -59,19 +56,5 @@ "version": "napi version -p scripts/npm" | ||
"devDependencies": { | ||
"@napi-rs/cli": "^2.16.1", | ||
"@napi-rs/cli": "^3.0.0-alpha.43", | ||
"typescript": "^5.1.6" | ||
}, | ||
"optionalDependencies": { | ||
"@swc/html-win32-x64-msvc": "0.0.28", | ||
"@swc/html-darwin-x64": "0.0.28", | ||
"@swc/html-linux-x64-gnu": "0.0.28", | ||
"@swc/html-linux-x64-musl": "0.0.28", | ||
"@swc/html-win32-ia32-msvc": "0.0.28", | ||
"@swc/html-linux-arm64-gnu": "0.0.28", | ||
"@swc/html-linux-arm-gnueabihf": "0.0.28", | ||
"@swc/html-darwin-arm64": "0.0.28", | ||
"@swc/html-android-arm64": "0.0.28", | ||
"@swc/html-linux-arm64-musl": "0.0.28", | ||
"@swc/html-win32-arm64-msvc": "0.0.28", | ||
"@swc/html-android-arm-eabi": "0.0.28" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
15628
0
438
4
4
2