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.10.0-alpha.1

14

dist/cjs/index.js

@@ -20,10 +20,16 @@ "use strict";

var parser_postcss_1 = __importDefault(require("prettier/parser-postcss"));
var constants_1 = require("@teleporthq/teleport-shared/dist/cjs/constants");
var parser_typescript_1 = __importDefault(require("prettier/parser-typescript"));
var teleport_shared_1 = require("@teleporthq/teleport-shared");
var teleport_types_1 = require("@teleporthq/teleport-types");
exports.createPostProcessor = function (options) {
if (options === void 0) { options = {}; }
var fileType = options.fileType || constants_1.FILE_TYPE.JS;
var formatOptions = __assign({}, constants_1.PRETTIER_CONFIG, options.formatOptions);
var fileType = options.fileType || teleport_types_1.FileType.JS;
var formatOptions = __assign({}, teleport_shared_1.Constants.PRETTIER_CONFIG, options.formatOptions);
var jsParser = fileType === teleport_types_1.FileType.TS ? parser_typescript_1.default : parser_babylon_1.default;
var plugins = [jsParser, parser_postcss_1.default];
var parser = fileType === teleport_types_1.FileType.TS ? 'typescript' : 'babel';
var processor = function (codeChunks) {
if (codeChunks[fileType]) {
codeChunks[fileType] = standalone_1.format(codeChunks[fileType], __assign({}, formatOptions, { plugins: [parser_babylon_1.default, parser_postcss_1.default], parser: 'babel' }));
codeChunks[fileType] = standalone_1.format(codeChunks[fileType], __assign({}, formatOptions, { plugins: plugins,
parser: parser }));
}

@@ -30,0 +36,0 @@ else {

import { format } from 'prettier/standalone';
import parserBabylon from 'prettier/parser-babylon';
import parserPostCSS from 'prettier/parser-postcss';
import { PRETTIER_CONFIG, FILE_TYPE } from '@teleporthq/teleport-shared/dist/cjs/constants';
import parserTypescript from 'prettier/parser-typescript';
import { Constants } from '@teleporthq/teleport-shared';
import { FileType } from '@teleporthq/teleport-types';
export const createPostProcessor = (options = {}) => {
const fileType = options.fileType || FILE_TYPE.JS;
const formatOptions = { ...PRETTIER_CONFIG, ...options.formatOptions };
const fileType = options.fileType || FileType.JS;
const formatOptions = { ...Constants.PRETTIER_CONFIG, ...options.formatOptions };
const jsParser = fileType === FileType.TS ? parserTypescript : parserBabylon;
const plugins = [jsParser, parserPostCSS];
const parser = fileType === FileType.TS ? 'typescript' : 'babel';
const processor = (codeChunks) => {

@@ -12,4 +17,4 @@ if (codeChunks[fileType]) {

...formatOptions,
plugins: [parserBabylon, parserPostCSS],
parser: 'babel',
plugins,
parser,
});

@@ -16,0 +21,0 @@ }

{
"name": "@teleporthq/teleport-postprocessor-prettier-js",
"version": "0.10.0-alpha.0",
"version": "0.10.0-alpha.1",
"description": "A post-processing function that formats js code chunks using prettier and the prettier-js plugin",

@@ -28,7 +28,7 @@ "author": "teleportHQ",

"dependencies": {
"@teleporthq/teleport-shared": "^0.10.0-alpha.0",
"@teleporthq/teleport-types": "^0.10.0-alpha.0",
"@teleporthq/teleport-shared": "^0.10.0-alpha.1",
"@teleporthq/teleport-types": "^0.10.0-alpha.1",
"prettier": "^1.18.2"
},
"gitHead": "480608bdc4929aff12210f6c4b994a6251fc2f6e"
"gitHead": "d4c96887909af2dd6b68054751aa7eca8a48a4d0"
}

@@ -5,5 +5,6 @@ import { format } from 'prettier/standalone'

import parserPostCSS from 'prettier/parser-postcss'
import parserTypescript from 'prettier/parser-typescript'
import { PRETTIER_CONFIG, FILE_TYPE } from '@teleporthq/teleport-shared/dist/cjs/constants'
import { PostProcessor, PrettierFormatOptions } from '@teleporthq/teleport-types'
import { Constants } from '@teleporthq/teleport-shared'
import { PostProcessor, PrettierFormatOptions, FileType } from '@teleporthq/teleport-types'

@@ -16,5 +17,9 @@ interface PostProcessorFactoryOptions {

export const createPostProcessor = (options: PostProcessorFactoryOptions = {}) => {
const fileType = options.fileType || FILE_TYPE.JS
const formatOptions = { ...PRETTIER_CONFIG, ...options.formatOptions }
const fileType = options.fileType || FileType.JS
const formatOptions = { ...Constants.PRETTIER_CONFIG, ...options.formatOptions }
const jsParser = fileType === FileType.TS ? parserTypescript : parserBabylon
const plugins = [jsParser, parserPostCSS]
const parser = fileType === FileType.TS ? 'typescript' : 'babel'
const processor: PostProcessor = (codeChunks) => {

@@ -24,4 +29,4 @@ if (codeChunks[fileType]) {

...formatOptions,
plugins: [parserBabylon, parserPostCSS],
parser: 'babel',
plugins,
parser,
})

@@ -28,0 +33,0 @@ } else {

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

Sorry, the diff of this file is not supported yet