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

@scandipwa/babel-plugin-middleware-decorator

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scandipwa/babel-plugin-middleware-decorator - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3-alpha.0

52

index.js

@@ -5,2 +5,16 @@ /* eslint-disable new-cap */

const path = require('path');
const { getParentThemePaths } = require('@scandipwa/scandipwa-dev-utils/parent-theme');
const extensions = require('@scandipwa/scandipwa-dev-utils/extensions');
const allowedPaths = [
...getParentThemePaths(),
process.cwd(),
...extensions.map(({ packagePath }) => packagePath)
].reduce((acc, pathname) => [
...acc,
path.join(pathname, 'src'),
path.join(pathname, 'public')
], []);
const namespaceExtractor = /@namespace +(?<namespace>[^ ]+)/;

@@ -61,2 +75,16 @@

const isMustProcessNamespace = (state) => {
const { filename } = state.file.opts;
for (let i = 0; i < allowedPaths.length; i++) {
const allowedPath = allowedPaths[i];
if (filename.includes(allowedPath)) {
return true;
}
}
return false;
};
module.exports = ({ types, parse }) => ({

@@ -66,3 +94,7 @@ name: 'middleware-decorators',

// Transform leading comments of anonymous arrow functions
ArrowFunctionExpression: (path) => {
ArrowFunctionExpression: (path, state) => {
if (!isMustProcessNamespace(state)) {
return;
}
const namespace = getNamespaceFromPath(path);

@@ -81,3 +113,7 @@ if (!namespace) {

VariableDeclaration: (path) => {
VariableDeclaration: (path, state) => {
if (!isMustProcessNamespace(state)) {
return;
}
const namespace = getNamespaceFromPath(path);

@@ -99,3 +135,7 @@ if (!namespace) {

FunctionDeclaration: (path) => {
FunctionDeclaration: (path, state) => {
if (!isMustProcessNamespace(state)) {
return;
}
const namespace = getNamespaceFromPath(path);

@@ -128,3 +168,7 @@ if (!namespace) {

ClassDeclaration: (path) => {
ClassDeclaration: (path, state) => {
if (!isMustProcessNamespace(state)) {
return;
}
const namespace = getNamespaceFromPath(path);

@@ -131,0 +175,0 @@

4

package.json
{
"name": "@scandipwa/babel-plugin-middleware-decorator",
"version": "0.0.2",
"version": "0.0.3-alpha.0",
"main": "index.js",

@@ -9,3 +9,3 @@ "license": "OSL-3.0",

},
"gitHead": "9a20d82ccff47f83fbea315370d30806848ccddb"
"gitHead": "3f6eb6f8f3a219998f8ea6fb006737c9fbcb6c93"
}
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