Comparing version 0.0.20 to 0.0.24
@@ -7,16 +7,14 @@ /* tslint:disable */ | ||
export interface Diagnostic { | ||
level: string; | ||
message: string; | ||
span: any; | ||
level: string | ||
message: string | ||
span: any | ||
} | ||
export interface TransformOutput { | ||
code: string; | ||
map?: string; | ||
errors?: Array<Diagnostic>; | ||
code: string | ||
map?: string | ||
errors?: Array<Diagnostic> | ||
} | ||
export function minify( | ||
code: Buffer, | ||
opts: Buffer, | ||
signal?: AbortSignal | undefined | null | ||
): Promise<TransformOutput>; | ||
export function minifySync(code: Buffer, opts: Buffer): TransformOutput; | ||
export function minify(code: Buffer, opts: Buffer, signal?: AbortSignal | undefined | null): Promise<TransformOutput> | ||
export function minifySync(code: Buffer, opts: Buffer): TransformOutput | ||
export function transform(code: Buffer, opts: Buffer, signal?: AbortSignal | undefined | null): Promise<TransformOutput> | ||
export function transformSync(code: Buffer, opts: Buffer): TransformOutput |
10
index.js
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.minifySync = exports.minify = void 0; | ||
exports.transformSync = exports.transform = exports.minifySync = exports.minify = void 0; | ||
const binding = __importStar(require("./binding")); | ||
@@ -37,4 +37,12 @@ async function minify(content, options) { | ||
exports.minifySync = minifySync; | ||
async function transform(content, options) { | ||
return binding.transform(content, toBuffer(options !== null && options !== void 0 ? options : {})); | ||
} | ||
exports.transform = transform; | ||
function transformSync(content, options) { | ||
return binding.transformSync(content, toBuffer(options !== null && options !== void 0 ? options : {})); | ||
} | ||
exports.transformSync = transformSync; | ||
function toBuffer(t) { | ||
return Buffer.from(JSON.stringify(t)); | ||
} |
31
index.ts
import * as binding from "./binding"; | ||
export type Options = { | ||
export type MinifyOptions = { | ||
filename?: string; | ||
@@ -8,5 +8,19 @@ sourceMap?: boolean; | ||
export type TransformOptions = { | ||
filename?: string; | ||
sourceMap?: boolean | ||
cssModules?: CssModuleTransformOptions | ||
minify?: boolean | ||
} | ||
export type CssModuleTransformOptions = { | ||
pattern: String, | ||
} | ||
export async function minify( | ||
content: Buffer, | ||
options: Options | ||
options: MinifyOptions | ||
): Promise<binding.TransformOutput> { | ||
@@ -16,8 +30,19 @@ return binding.minify(content, toBuffer(options ?? {})); | ||
export function minifySync(content: Buffer, options: Options) { | ||
export function minifySync(content: Buffer, options: MinifyOptions) { | ||
return binding.minifySync(content, toBuffer(options ?? {})); | ||
} | ||
export async function transform( | ||
content: Buffer, | ||
options: TransformOptions | ||
): Promise<binding.TransformOutput> { | ||
return binding.transform(content, toBuffer(options ?? {})); | ||
} | ||
export function transformSync(content: Buffer, options: TransformOptions) { | ||
return binding.transformSync(content, toBuffer(options ?? {})); | ||
} | ||
function toBuffer(t: any): Buffer { | ||
return Buffer.from(JSON.stringify(t)); | ||
} |
{ | ||
"name": "@swc/css", | ||
"version": "0.0.20", | ||
"packageManager": "yarn@3.2.3", | ||
"version": "0.0.24", | ||
"description": "Super-fast alternative for postcss", | ||
@@ -29,3 +30,2 @@ "homepage": "https://swc.rs", | ||
"x86_64-unknown-linux-musl", | ||
"x86_64-unknown-freebsd", | ||
"i686-pc-windows-msvc", | ||
@@ -57,17 +57,20 @@ "aarch64-unknown-linux-gnu", | ||
}, | ||
"devDependencies": { | ||
"@napi-rs/cli": "^2.16.1", | ||
"typescript": "^5.1.6" | ||
}, | ||
"optionalDependencies": { | ||
"@swc/css-win32-x64-msvc": "0.0.20", | ||
"@swc/css-darwin-x64": "0.0.20", | ||
"@swc/css-linux-x64-gnu": "0.0.20", | ||
"@swc/css-linux-x64-musl": "0.0.20", | ||
"@swc/css-freebsd-x64": "0.0.20", | ||
"@swc/css-win32-ia32-msvc": "0.0.20", | ||
"@swc/css-linux-arm64-gnu": "0.0.20", | ||
"@swc/css-linux-arm-gnueabihf": "0.0.20", | ||
"@swc/css-darwin-arm64": "0.0.20", | ||
"@swc/css-android-arm64": "0.0.20", | ||
"@swc/css-linux-arm64-musl": "0.0.20", | ||
"@swc/css-win32-arm64-msvc": "0.0.20", | ||
"@swc/css-android-arm-eabi": "0.0.20" | ||
"@swc/css-win32-x64-msvc": "0.0.24", | ||
"@swc/css-darwin-x64": "0.0.24", | ||
"@swc/css-linux-x64-gnu": "0.0.24", | ||
"@swc/css-linux-x64-musl": "0.0.24", | ||
"@swc/css-win32-ia32-msvc": "0.0.24", | ||
"@swc/css-linux-arm64-gnu": "0.0.24", | ||
"@swc/css-linux-arm-gnueabihf": "0.0.24", | ||
"@swc/css-darwin-arm64": "0.0.24", | ||
"@swc/css-android-arm64": "0.0.24", | ||
"@swc/css-linux-arm64-musl": "0.0.24", | ||
"@swc/css-win32-arm64-msvc": "0.0.24", | ||
"@swc/css-android-arm-eabi": "0.0.24" | ||
} | ||
} |
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
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
12
0
6035
2
4
98
1