Socket
Socket
Sign inDemoInstall

@swc/core

Package Overview
Dependencies
Maintainers
1
Versions
687
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swc/core - npm Package Compare versions

Comparing version 1.0.32 to 1.0.33

1

lib/index.d.ts

@@ -1338,2 +1338,3 @@

key: Identifier;
value: Expression;

@@ -1340,0 +1341,0 @@ }

@@ -63,2 +63,3 @@

options = options || {};
const hasPlugins = loadPlugins(options);

@@ -73,4 +74,12 @@ return new Promise((resolve, reject) => {

transformSync(src, options) {
options = options || {};
const hasPlugins = loadPlugins(options);
return super.transformSync(src, options)
}
transformFile(path, options) {
options = options || {};
const hasPlugins = loadPlugins(options);

@@ -84,4 +93,37 @@ return new Promise((resolve, reject) => {

}
transformFileSync(path, options) {
options = options || {};
const hasPlugins = loadPlugins(options);
return super.transformFileSync(path, options)
}
}
/**
* @returns true if options contain plugin
*/
function loadPlugins(options) {
if (!options.hasOwnProperty('plugins')) {
return false;
}
if (!Array.isArray(options.plugins)) {
throw new TypeError('options.plugin must be array of function / string')
}
for (const i = 0; i < options.plugins.length; i++) {
let plugin = options.plugins[i];
if (typeof plugin === 'string') {
plugin = require(plugin)
} else if (typeof plugin === 'function') {
} else {
throw new TypeError('options.plugin must be array of function / string')
}
plugins[i] = plugin;
}
return true;
}
const compiler = new Compiler();

@@ -88,0 +130,0 @@

2

package.json
{
"name": "@swc/core",
"version": "1.0.32",
"version": "1.0.33",
"description": "Super-fast alternative for babel",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc