Socket
Socket
Sign inDemoInstall

unplugin

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unplugin - npm Package Compare versions

Comparing version 0.6.3 to 0.7.0

3

dist/index.d.ts

@@ -1,2 +0,2 @@

import { SourceMap, EmittedAsset, Plugin, PluginContextMeta } from 'rollup';
import { SourceMap, EmittedAsset, AcornNode, Plugin, PluginContextMeta } from 'rollup';
export { Plugin as RollupPlugin } from 'rollup';

@@ -24,2 +24,3 @@ import { Compiler, WebpackPluginInstance } from 'webpack';

getWatchFiles: () => string[];
parse: (input: string, options?: any) => AcornNode;
}

@@ -26,0 +27,0 @@ interface UnpluginOptions {

@@ -46,6 +46,2 @@ var __create = Object.create;

// node_modules/.pnpm/tsup@5.12.7_typescript@4.6.4/node_modules/tsup/assets/cjs_shims.js
var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
// src/esbuild/index.ts

@@ -55,2 +51,3 @@ var import_fs = __toESM(require("fs"));

var import_chokidar = __toESM(require("chokidar"));
var import_acorn = require("acorn");

@@ -1035,3 +1032,3 @@ // src/esbuild/utils.ts

return (userOptions) => {
var _a, _b;
var _a;
const meta = {

@@ -1043,7 +1040,14 @@ framework: "esbuild"

name: plugin.name,
setup: (_b = (_a = plugin.esbuild) == null ? void 0 : _a.setup) != null ? _b : function setup({ onStart, onEnd, onResolve, onLoad, initialOptions, esbuild: { build: build2 } }) {
var _a2, _b2, _c, _d;
const onResolveFilter = (_b2 = (_a2 = plugin.esbuild) == null ? void 0 : _a2.onResolveFilter) != null ? _b2 : /.*/;
const onLoadFilter = (_d = (_c = plugin.esbuild) == null ? void 0 : _c.onLoadFilter) != null ? _d : /.*/;
setup: ((_a = plugin.esbuild) == null ? void 0 : _a.setup) ?? function setup({ onStart, onEnd, onResolve, onLoad, initialOptions, esbuild: { build: build2 } }) {
var _a2, _b;
const onResolveFilter = ((_a2 = plugin.esbuild) == null ? void 0 : _a2.onResolveFilter) ?? /.*/;
const onLoadFilter = ((_b = plugin.esbuild) == null ? void 0 : _b.onLoadFilter) ?? /.*/;
const context = {
parse(code, opts = {}) {
return import_acorn.Parser.parse(code, __spreadValues({
sourceType: "module",
ecmaVersion: "latest",
locations: true
}, opts));
},
addWatchFile(id) {

@@ -1239,10 +1243,17 @@ watchList.add(import_path2.default.resolve(id));

// src/webpack/genContext.ts
// src/webpack/context.ts
var import_path4 = require("path");
var import_webpack_sources = __toESM(require("webpack-sources"));
function genContext(compilation) {
var import_acorn2 = require("acorn");
function createContext(compilation) {
return {
parse(code, opts = {}) {
return import_acorn2.Parser.parse(code, __spreadValues({
sourceType: "module",
ecmaVersion: "latest",
locations: true
}, opts));
},
addWatchFile(id) {
var _a;
((_a = compilation.fileDependencies) != null ? _a : compilation.compilationDependencies).add((0, import_path4.resolve)(process.cwd(), id));
(compilation.fileDependencies ?? compilation.compilationDependencies).add((0, import_path4.resolve)(process.cwd(), id));
},

@@ -1259,4 +1270,3 @@ emitFile(emittedFile) {

getWatchFiles() {
var _a;
return Array.from((_a = compilation.fileDependencies) != null ? _a : compilation.compilationDependencies);
return Array.from(compilation.fileDependencies ?? compilation.compilationDependencies);
}

@@ -1267,3 +1277,4 @@ };

// src/webpack/index.ts
var _dirname = typeof __dirname !== "undefined" ? __dirname : (0, import_path5.dirname)((0, import_url.fileURLToPath)(importMetaUrl));
var import_meta = {};
var _dirname = typeof __dirname !== "undefined" ? __dirname : (0, import_path5.dirname)((0, import_url.fileURLToPath)(import_meta.url));
var TRANSFORM_LOADER = (0, import_path5.resolve)(_dirname, "webpack/loaders/transform.js");

@@ -1375,3 +1386,3 @@ var LOAD_LOADER = (0, import_path5.resolve)(_dirname, "webpack/loaders/load.js");

compiler.hooks.make.tapPromise(plugin.name, async (compilation) => {
const context = genContext(compilation);
const context = createContext(compilation);
if (plugin.watchChange && (compiler.modifiedFiles || compiler.removedFiles)) {

@@ -1394,3 +1405,3 @@ const promises = [];

compiler.hooks.emit.tapPromise(plugin.name, async (compilation) => {
await plugin.buildEnd.call(genContext(compilation));
await plugin.buildEnd.call(createContext(compilation));
});

@@ -1397,0 +1408,0 @@ }

@@ -5,4 +5,18 @@ var __create = Object.create;

var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __export = (target, all) => {

@@ -30,10 +44,17 @@ for (var name in all)

// src/webpack/genContext.ts
// src/webpack/context.ts
var import_path = require("path");
var import_webpack_sources = __toESM(require("webpack-sources"));
function genContext(compilation) {
var import_acorn = require("acorn");
function createContext(compilation) {
return {
parse(code, opts = {}) {
return import_acorn.Parser.parse(code, __spreadValues({
sourceType: "module",
ecmaVersion: "latest",
locations: true
}, opts));
},
addWatchFile(id) {
var _a;
((_a = compilation.fileDependencies) != null ? _a : compilation.compilationDependencies).add((0, import_path.resolve)(process.cwd(), id));
(compilation.fileDependencies ?? compilation.compilationDependencies).add((0, import_path.resolve)(process.cwd(), id));
},

@@ -50,4 +71,3 @@ emitFile(emittedFile) {

getWatchFiles() {
var _a;
return Array.from((_a = compilation.fileDependencies) != null ? _a : compilation.compilationDependencies);
return Array.from(compilation.fileDependencies ?? compilation.compilationDependencies);
}

@@ -64,3 +84,3 @@ };

async function load(source, map) {
var _a, _b;
var _a;
const callback = this.async();

@@ -80,7 +100,7 @@ const { unpluginName } = this.query;

}
const res = await plugin.load.call(Object.assign(this._compilation && genContext(this._compilation), context), slash(id));
const res = await plugin.load.call(Object.assign(this._compilation && createContext(this._compilation), context), slash(id));
if (res == null) {
callback(null, source, map);
} else if (typeof res !== "string") {
callback(null, res.code, (_b = res.map) != null ? _b : map);
callback(null, res.code, res.map ?? map);
} else {

@@ -87,0 +107,0 @@ callback(null, res, map);

@@ -5,4 +5,18 @@ var __create = Object.create;

var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __export = (target, all) => {

@@ -30,10 +44,17 @@ for (var name in all)

// src/webpack/genContext.ts
// src/webpack/context.ts
var import_path = require("path");
var import_webpack_sources = __toESM(require("webpack-sources"));
function genContext(compilation) {
var import_acorn = require("acorn");
function createContext(compilation) {
return {
parse(code, opts = {}) {
return import_acorn.Parser.parse(code, __spreadValues({
sourceType: "module",
ecmaVersion: "latest",
locations: true
}, opts));
},
addWatchFile(id) {
var _a;
((_a = compilation.fileDependencies) != null ? _a : compilation.compilationDependencies).add((0, import_path.resolve)(process.cwd(), id));
(compilation.fileDependencies ?? compilation.compilationDependencies).add((0, import_path.resolve)(process.cwd(), id));
},

@@ -50,4 +71,3 @@ emitFile(emittedFile) {

getWatchFiles() {
var _a;
return Array.from((_a = compilation.fileDependencies) != null ? _a : compilation.compilationDependencies);
return Array.from(compilation.fileDependencies ?? compilation.compilationDependencies);
}

@@ -70,3 +90,3 @@ };

};
const res = await plugin.transform.call(Object.assign(this._compilation && genContext(this._compilation), context), source, this.resource);
const res = await plugin.transform.call(Object.assign(this._compilation && createContext(this._compilation), context), source, this.resource);
if (res == null) {

@@ -73,0 +93,0 @@ callback(null, source, map);

{
"name": "unplugin",
"version": "0.6.3",
"packageManager": "pnpm@7.0.0",
"version": "0.7.0",
"packageManager": "pnpm@7.1.8",
"description": "Unified plugin system for build tools",

@@ -33,2 +33,3 @@ "repository": "unjs/unplugin",

"dependencies": {
"acorn": "^8.7.1",
"chokidar": "^3.5.3",

@@ -49,14 +50,14 @@ "webpack-sources": "^3.2.3",

"enhanced-resolve": "^5.9.3",
"esbuild": "^0.14.38",
"eslint": "^8.15.0",
"esbuild": "^0.14.42",
"eslint": "^8.17.0",
"fast-glob": "^3.2.11",
"fs-extra": "^10.1.0",
"jiti": "^1.13.0",
"magic-string": "^0.26.1",
"rollup": "^2.72.1",
"tsup": "^5.12.7",
"typescript": "^4.6.4",
"vite": "^2.9.8",
"vitest": "^0.10.5",
"webpack": "^5.72.0",
"magic-string": "^0.26.2",
"rollup": "^2.75.5",
"tsup": "^6.1.0",
"typescript": "^4.7.3",
"vite": "^2.9.9",
"vitest": "^0.14.0",
"webpack": "^5.73.0",
"webpack-cli": "^4.9.2"

@@ -63,0 +64,0 @@ },

@@ -40,2 +40,3 @@ # unplugin

| ---- | :----: | :--: | :-------: | :-------: | :-----: |
| [`this.parse`](https://rollupjs.org/guide/en/#thisparse) | ✅ | ✅ | ✅ | ✅ | ✅ |
| [`this.addWatchFile`](https://rollupjs.org/guide/en/#thisaddwatchfile) | ✅ | ✅ | ✅ | ✅ | ✅ |

@@ -42,0 +43,0 @@ | [`this.emitFile`](https://rollupjs.org/guide/en/#thisemitfile)<sup>4</sup> | ✅ | ✅ | ✅ | ✅ | ✅ |

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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