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

babel-plugin-flask-urls

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-flask-urls - npm Package Compare versions

Comparing version

to
0.0.2

22

lib/plugin.js

@@ -10,6 +10,8 @@ "use strict";

const flaskURLPlugin = ({
types: t,
template
}, opts = {}) => {
const flaskURLPlugin = function flaskURLPlugin(_ref) {
let {
types: t,
template
} = _ref;
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const buildFunc = template.expression('FUNC.bind(null, RULE, BASE)');

@@ -20,3 +22,3 @@ const importPrefix = opts.importPrefix || 'flask-url';

const basePath = opts.basePath || '';
const importRegex = new RegExp(`^${importPrefix}:(.+)$`);
const importRegex = new RegExp("^".concat(importPrefix, ":(.+)$"));
return {

@@ -37,7 +39,7 @@ name: 'flask-urls',

if (path.node.specifiers.length === 0) {
throw path.buildCodeFrameError(`${importPrefix} imports must use a default import`);
throw path.buildCodeFrameError("".concat(importPrefix, " imports must use a default import"));
} else if (path.node.specifiers.length > 1) {
throw path.get('specifiers.1').buildCodeFrameError(`${importPrefix} imports must use exactly one import`);
throw path.get('specifiers.1').buildCodeFrameError("".concat(importPrefix, " imports must use exactly one import"));
} else if (!t.isImportDefaultSpecifier(path.node.specifiers[0])) {
throw path.get('specifiers.0').buildCodeFrameError(`${importPrefix} imports must use a default import`);
throw path.get('specifiers.0').buildCodeFrameError("".concat(importPrefix, " imports must use a default import"));
}

@@ -49,3 +51,3 @@

if (!data) {
throw path.get('source').buildCodeFrameError(`${importPrefix} imports must reference a valid flask endpoint`);
throw path.get('source').buildCodeFrameError("".concat(importPrefix, " imports must reference a valid flask endpoint"));
}

@@ -74,3 +76,3 @@

type: 'CommentBlock',
value: ` flask url builder for '${endpoint}' `
value: " flask url builder for '".concat(endpoint, "' ")
}]

@@ -77,0 +79,0 @@ });

{
"name": "babel-plugin-flask-urls",
"version": "0.0.1",
"version": "0.0.2",
"description": "Adds support for importing Flask routing rules to generate URLs client-side.",
"main": "lib/plugin.js",
"scripts": {
"build": "rm -rf lib/ && babel src/ --out-dir lib/",
"prepare": "npm run build"
},
"repository": "github:indico/js-flask-urls",

@@ -25,22 +21,20 @@ "keywords": [

"peerDependencies": {
"@babel/core": "^7.0.0-beta",
"@babel/helper-module-imports": "^7.0.0-beta"
"@babel/core": "^7.4.5",
"@babel/helper-module-imports": "^7.0.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.44",
"@babel/core": "^7.0.0-beta.44",
"@babel/preset-env": "^7.0.0-beta.44"
"jest": {
"transform": {
"^.+\\.js$": "../../babel-jest"
}
},
"babel": {
"presets": [
[
"@babel/env",
{
"targets": {
"node": "current"
}
}
]
]
}
"extends": "../../.babelrc"
},
"scripts": {
"eslint": "../../node_modules/.bin/eslint .",
"test": "../../node_modules/.bin/jest",
"build": "rm -rf lib/ && ../../node_modules/.bin/babel src/ --out-dir lib/",
"prepare": "npm run build"
},
"gitHead": "c1e3c573af44772f594c51414a3237313d2abc16"
}