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

@teleporthq/teleport-postprocessor-prettier-js

Package Overview
Dependencies
Maintainers
5
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teleporthq/teleport-postprocessor-prettier-js - npm Package Compare versions

Comparing version

to
0.17.0

dist/cjs/tsconfig.tsbuildinfo

100

dist/cjs/index.js

@@ -1,38 +0,68 @@

"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 __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
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 __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
Object.defineProperty(exports, "__esModule", { value: true });
var standalone_1 = require("prettier/standalone");
var parser_babel_1 = __importDefault(require("prettier/parser-babel"));
var teleport_shared_1 = require("@teleporthq/teleport-shared");
var teleport_types_1 = require("@teleporthq/teleport-types");
exports.createPrettierJSPostProcessor = function (options) {
if (options === void 0) { options = {}; }
var fileType = options.fileType || teleport_types_1.FileType.JS;
var formatOptions = __assign(__assign({}, teleport_shared_1.Constants.PRETTIER_CONFIG), options.formatOptions);
var plugins = [parser_babel_1.default];
var processor = function (codeChunks) {
if (codeChunks[fileType]) {
codeChunks[fileType] = standalone_1.format(codeChunks[fileType], __assign(__assign({}, formatOptions), { plugins: plugins, parser: 'babel' }));
}
else {
console.warn('No code chunk of type JS found, prettier-js did not perform any operation');
}
return codeChunks;
};
return processor;
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
exports.default = exports.createPrettierJSPostProcessor();
//# sourceMappingURL=index.js.map
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
// packages/teleport-postprocessor-prettier-js/src/index.ts
__markAsModule(exports);
__export(exports, {
createPrettierJSPostProcessor: () => createPrettierJSPostProcessor,
default: () => src_default
});
var import_standalone = __toModule(require("prettier/standalone"));
var import_parser_babel = __toModule(require("prettier/parser-babel"));
var import_teleport_shared = __toModule(require("@teleporthq/teleport-shared"));
var import_teleport_types = __toModule(require("@teleporthq/teleport-types"));
var createPrettierJSPostProcessor = (options = {}) => {
const fileType = options.fileType || import_teleport_types.FileType.JS;
const formatOptions = __spreadValues(__spreadValues({}, import_teleport_shared.Constants.PRETTIER_CONFIG), options.formatOptions);
const plugins = [import_parser_babel.default];
const processor = (codeChunks) => {
if (codeChunks[fileType]) {
codeChunks[fileType] = (0, import_standalone.format)(codeChunks[fileType], __spreadProps(__spreadValues({}, formatOptions), {
plugins,
parser: "babel"
}));
} else {
console.warn("No code chunk of type JS found, prettier-js did not perform any operation");
}
return codeChunks;
};
return processor;
};
var src_default = createPrettierJSPostProcessor();

@@ -1,25 +0,47 @@

import { format } from 'prettier/standalone';
import parserBabel from 'prettier/parser-babel';
import { Constants } from '@teleporthq/teleport-shared';
import { FileType } from '@teleporthq/teleport-types';
export const createPrettierJSPostProcessor = (options = {}) => {
const fileType = options.fileType || FileType.JS;
const formatOptions = { ...Constants.PRETTIER_CONFIG, ...options.formatOptions };
const plugins = [parserBabel];
const processor = (codeChunks) => {
if (codeChunks[fileType]) {
codeChunks[fileType] = format(codeChunks[fileType], {
...formatOptions,
plugins,
parser: 'babel',
});
}
else {
console.warn('No code chunk of type JS found, prettier-js did not perform any operation');
}
return codeChunks;
};
return processor;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
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;
};
export default createPrettierJSPostProcessor();
//# sourceMappingURL=index.js.map
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
// packages/teleport-postprocessor-prettier-js/src/index.ts
import { format } from "prettier/standalone";
import parserBabel from "prettier/parser-babel";
import { Constants } from "@teleporthq/teleport-shared";
import { FileType } from "@teleporthq/teleport-types";
var createPrettierJSPostProcessor = (options = {}) => {
const fileType = options.fileType || FileType.JS;
const formatOptions = __spreadValues(__spreadValues({}, Constants.PRETTIER_CONFIG), options.formatOptions);
const plugins = [parserBabel];
const processor = (codeChunks) => {
if (codeChunks[fileType]) {
codeChunks[fileType] = format(codeChunks[fileType], __spreadProps(__spreadValues({}, formatOptions), {
plugins,
parser: "babel"
}));
} else {
console.warn("No code chunk of type JS found, prettier-js did not perform any operation");
}
return codeChunks;
};
return processor;
};
var src_default = createPrettierJSPostProcessor();
export {
createPrettierJSPostProcessor,
src_default as default
};
{
"name": "@teleporthq/teleport-postprocessor-prettier-js",
"version": "0.16.3",
"version": "0.17.0",
"description": "A post-processing function that formats js code chunks using prettier and the babylon parser",

@@ -11,2 +11,7 @@ "author": "teleportHQ",

"module": "dist/esm/index.js",
"exports": {
"module": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js"
},
"sideEffects": false,

@@ -25,12 +30,10 @@ "repository": {

"clean": "rimraf dist",
"build": "npm run build:cjs & npm run build:esm",
"build:cjs": "tsc -p tsconfig-cjs.json",
"build:esm": "tsc -p tsconfig-esm.json"
"types": "tsc -p tsconfig.json"
},
"dependencies": {
"@teleporthq/teleport-shared": "^0.16.3",
"@teleporthq/teleport-types": "^0.16.3",
"@teleporthq/teleport-shared": "^0.17.0",
"@teleporthq/teleport-types": "^0.17.0",
"prettier": "^2.2.1"
},
"gitHead": "7e373501206d293ea7ac0494b563ee5f6a2fccb2"
"gitHead": "959317a18068b52ffd8b912e41d123f70d97e7bc"
}