New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unplugin-swc

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unplugin-swc - npm Package Compare versions

Comparing version 1.4.5 to 1.5.0

dist/index.cjs

90

dist/index.js

@@ -1,39 +0,5 @@

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
default: () => src_default
});
module.exports = __toCommonJS(src_exports);
var import_path2 = __toESM(require("path"));
var import_pluginutils = require("@rollup/pluginutils");
var import_core = require("@swc/core");
import path2 from "path";
import { createFilter } from "@rollup/pluginutils";
import { transform } from "@swc/core";

@@ -109,14 +75,14 @@ // node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs

// src/index.ts
var import_load_tsconfig = require("load-tsconfig");
var import_unplugin = require("unplugin");
import { loadTsConfig } from "load-tsconfig";
import { createUnplugin } from "unplugin";
// src/resolve.ts
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
import fs2 from "fs";
import path from "path";
// node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
var import_node_fs = __toESM(require("fs"), 1);
import fs, { promises as fsPromises } from "fs";
async function pathExists(path3) {
try {
await import_node_fs.promises.access(path3);
await fsPromises.access(path3);
return true;

@@ -129,18 +95,19 @@ } catch {

// src/resolve.ts
var RESOLVE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".mjs", ".cjs"];
var resolveFile = async (resolved, index = false) => {
var RESOLVE_EXTENSIONS = [".tsx", ".ts", ".mts", ".jsx", ".js", ".mjs", ".cjs"];
async function resolveFile(resolved, index = false) {
for (const ext of RESOLVE_EXTENSIONS) {
const file = index ? import_path.default.join(resolved, `index${ext}`) : `${resolved}${ext}`;
const file = index ? path.join(resolved, `index${ext}`) : `${resolved}${ext}`;
if (await pathExists(file))
return file;
}
};
var resolveId = async (importee, importer) => {
}
async function resolveId(importee, importer) {
if (importer && importee[0] === ".") {
const absolutePath = import_path.default.resolve(
importer ? import_path.default.dirname(importer) : process.cwd(),
const absolutePath = path.resolve(
// eslint-disable-next-line node/prefer-global/process
importer ? path.dirname(importer) : process.cwd(),
importee
);
let resolved = await resolveFile(absolutePath);
if (!resolved && await pathExists(absolutePath) && await import_fs.default.promises.stat(absolutePath).then((stat) => stat.isDirectory())) {
if (!resolved && await pathExists(absolutePath) && await fs2.promises.stat(absolutePath).then((stat) => stat.isDirectory())) {
resolved = await resolveFile(absolutePath, true);

@@ -150,9 +117,9 @@ }

}
};
}
// src/index.ts
var src_default = (0, import_unplugin.createUnplugin)(
var src_default = createUnplugin(
({ tsconfigFile, minify, include, exclude, ...options } = {}) => {
const filter = (0, import_pluginutils.createFilter)(
include || /\.[jt]sx?$/,
const filter = createFilter(
include || /\.m?[jt]sx?$/,
exclude || /node_modules/

@@ -166,7 +133,7 @@ );

return null;
const compilerOptions = tsconfigFile === false ? {} : (0, import_load_tsconfig.loadTsConfig)(
import_path2.default.dirname(id),
const compilerOptions = tsconfigFile === false ? {} : loadTsConfig(
path2.dirname(id),
tsconfigFile === true ? void 0 : tsconfigFile
)?.data?.compilerOptions || {};
const isTs = /\.tsx?$/.test(id);
const isTs = /\.m?tsx?$/.test(id);
let jsc = {

@@ -206,3 +173,3 @@ parser: {

}
const result = await (0, import_core.transform)(code, {
const result = await transform(code, {
filename: id,

@@ -228,3 +195,3 @@ sourceMaps: true,

if (minify) {
const result = await (0, import_core.transform)(code, {
const result = await transform(code, {
sourceMaps: true,

@@ -245,2 +212,5 @@ minify: true,

);
export {
src_default as default
};
//# sourceMappingURL=index.js.map
{
"name": "unplugin-swc",
"version": "1.4.5",
"packageManager": "pnpm@8.15.6",
"type": "module",
"version": "1.5.0",
"packageManager": "pnpm@9.4.0",
"description": "SWC plugin for Vite and Rollup",

@@ -9,3 +10,2 @@ "publishConfig": {

},
"license": "MIT",
"author": "EGOIST <hi@egoist.dev> (https://github.com/egoist)",

@@ -15,2 +15,4 @@ "contributors": [

],
"license": "MIT",
"homepage": "https://github.com/unplugin/unplugin-swc/tree/main/#readme",
"repository": {

@@ -23,4 +25,2 @@ "type": "git",

},
"homepage": "https://github.com/unplugin/unplugin-swc/tree/main/#readme",
"types": "./dist/index.d.ts",
"exports": {

@@ -38,2 +38,3 @@ ".": {

},
"types": "./dist/index.d.ts",
"files": [

@@ -44,3 +45,3 @@ "dist"

"build": "tsup",
"test": "npm run build && vitest",
"test": "vitest",
"lint": "eslint .",

@@ -57,18 +58,19 @@ "lint:fix": "eslint . --fix",

"load-tsconfig": "^0.2.5",
"unplugin": "^1.10.1"
"unplugin": "^1.11.0"
},
"devDependencies": {
"@hannoeru/eslint-config": "^0.9.7",
"@swc/core": "^1.4.11",
"@types/node": "^20.12.5",
"@antfu/eslint-config": "^2.21.2",
"@swc/core": "^1.6.6",
"@types/node": "^20.14.9",
"defu": "^6.1.4",
"esbuild": "0.20.2",
"eslint": "^9.6.0",
"path-exists": "^5.0.0",
"prettier": "3.2.5",
"rollup": "^4.14.0",
"rollup": "^4.18.0",
"tsup": "8.0.2",
"typescript": "5.4.4",
"vite": "^5.2.8",
"vitest": "^0.34.6"
"vite": "^5.3.2",
"vitest": "^1.6.0"
}
}

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