Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@preact/preset-vite

Package Overview
Dependencies
Maintainers
10
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@preact/preset-vite - npm Package Compare versions

Comparing version 2.1.7 to 2.2.0

45

dist/cjs/index.js
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -54,4 +65,11 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

function preactPlugin(_a) {
var _b = _a === void 0 ? {} : _a, devtoolsInProd = _b.devtoolsInProd, include = _b.include, exclude = _b.exclude;
var _b;
var _c = _a === void 0 ? {} : _a, devtoolsInProd = _c.devtoolsInProd, include = _c.include, exclude = _c.exclude, babel = _c.babel;
var config;
var babelOptions = __assign({ babelrc: false, configFile: false }, babel);
babelOptions.plugins || (babelOptions.plugins = []);
babelOptions.presets || (babelOptions.presets = []);
babelOptions.overrides || (babelOptions.overrides = []);
babelOptions.parserOpts || (babelOptions.parserOpts = {});
(_b = babelOptions.parserOpts).plugins || (_b.plugins = []);
var shouldTransform = utils_js_1.createFilter(include || [/\.[tj]sx?$/], exclude || [/node_modules/]);

@@ -106,19 +124,7 @@ var jsxPlugin = {

].filter(Boolean);
return [4 /*yield*/, core_1.transformAsync(code, {
babelrc: false,
configFile: false,
ast: true,
root: config.root,
filename: id,
parserOpts: {
sourceType: "module",
allowAwaitOutsideFunction: true,
plugins: parserPlugins
},
generatorOpts: {
decoratorsBeforeExport: true
},
plugins: __spreadArray([
return [4 /*yield*/, core_1.transformAsync(code, __assign(__assign({}, babelOptions), { ast: true, root: config.root, filename: id, parserOpts: __assign(__assign({}, babelOptions.parserOpts), { sourceType: "module", allowAwaitOutsideFunction: true, plugins: parserPlugins }), generatorOpts: __assign(__assign({}, babelOptions.generatorOpts), { decoratorsBeforeExport: true }), plugins: __spreadArray(__spreadArray(__spreadArray([], babelOptions.plugins), [
[
"@babel/plugin-transform-react-jsx",
config.isProduction
? "@babel/plugin-transform-react-jsx"
: "@babel/plugin-transform-react-jsx-development",
{

@@ -129,6 +135,3 @@ runtime: "automatic",

]
], (config.isProduction ? [] : ["babel-plugin-transform-hook-names"])),
sourceMaps: true,
inputSourceMap: false
})];
]), (config.isProduction ? [] : ["babel-plugin-transform-hook-names"])), sourceMaps: true, inputSourceMap: false }))];
case 1:

@@ -135,0 +138,0 @@ result = _a.sent();

import type { Plugin } from "vite";
import type { FilterPattern } from "@rollup/pluginutils";
import type { ParserOptions } from "@babel/parser";
import type { TransformOptions } from "@babel/core";
export declare type BabelOptions = Omit<TransformOptions, "ast" | "filename" | "root" | "sourceFileName" | "sourceMaps" | "inputSourceMap">;
export interface PreactPluginOptions {

@@ -17,3 +20,15 @@ /**

exclude?: FilterPattern;
/**
* Babel configuration applied in both dev and prod.
*/
babel?: BabelOptions;
}
export default function preactPlugin({ devtoolsInProd, include, exclude, }?: PreactPluginOptions): Plugin[];
export interface PreactBabelOptions extends BabelOptions {
plugins: Extract<BabelOptions["plugins"], any[]>;
presets: Extract<BabelOptions["presets"], any[]>;
overrides: Extract<BabelOptions["overrides"], any[]>;
parserOpts: ParserOptions & {
plugins: Extract<ParserOptions["plugins"], any[]>;
};
}
export default function preactPlugin({ devtoolsInProd, include, exclude, babel, }?: PreactPluginOptions): Plugin[];
{
"name": "@preact/preset-vite",
"version": "2.1.7",
"version": "2.2.0",
"description": "Preact preset for the vite bundler",

@@ -35,2 +35,3 @@ "main": "./dist/cjs/index.js",

"@babel/plugin-transform-react-jsx": "^7.14.9",
"@babel/plugin-transform-react-jsx-development": "^7.16.7",
"@prefresh/vite": "^2.2.6",

@@ -37,0 +38,0 @@ "@rollup/pluginutils": "^4.1.1",

@@ -49,4 +49,22 @@ # @preact/preset-vite

### Babel configuration
The `babel` option lets you add plugins, presets, and [other configuration](https://babeljs.io/docs/en/options) to the Babel transformation performed on each JSX/TSX file.
```js
preact({
babel: {
presets: [...],
// Your plugins run before any built-in transform (eg: Fast Refresh)
plugins: [...],
// Use .babelrc files
babelrc: true,
// Use babel.config.js files
configFile: true,
}
})
```
## License
MIT, see [the license file](./LICENSE).

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