Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-tools/graphql-tag-pluck

Package Overview
Dependencies
Maintainers
3
Versions
1095
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/graphql-tag-pluck - npm Package Compare versions

Comparing version 8.1.0 to 8.2.0-rc-20240122213929-baacb44f7c0da8e192575934b6bcdfd408020825

3

cjs/config.js

@@ -71,2 +71,5 @@ "use strict";

break;
case '.astro':
plugins.push('typescript', 'jsx');
break;
default:

@@ -73,0 +76,0 @@ plugins.push('jsx', ...dynamicFlowPlugins);

@@ -30,2 +30,3 @@ "use strict";

'.svelte',
'.astro',
];

@@ -44,6 +45,17 @@ // tslint:disable-next-line: no-implicit-dependencies

}
// tslint:disable-next-line: no-implicit-dependencies
async function parseWithAstro(astroCompiler, fileData) {
const fileInTsx = await astroCompiler.transform(fileData);
return fileInTsx.code;
}
function parseWithAstroSync(
// tslint:disable-next-line: no-implicit-dependencies
astroCompiler, fileData) {
const fileInTsx = astroCompiler.transform(fileData, undefined);
return fileInTsx.code;
}
/**
* Asynchronously plucks GraphQL template literals from a single file.
*
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`, `.astro`
*

@@ -63,2 +75,5 @@ * @param filePath Path to the file containing the code. Required to detect the file type

}
else if (fileExt === '.astro') {
code = await pluckAstroFileScript(code);
}
return parseCode({ code, filePath, options }).map(t => new graphql_1.Source(t.content, filePath, t.loc.start));

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

*
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mjs`, `.cjs`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mjs`, `.cjs`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`, `.astro`
*

@@ -86,2 +101,5 @@ * @param filePath Path to the file containing the code. Required to detect the file type

}
else if (fileExt === '.astro') {
code = pluckAstroFileScriptSync(code);
}
return parseCode({ code, filePath, options }).map(t => new graphql_1.Source(t.content, filePath, t.loc.start));

@@ -139,2 +157,14 @@ };

`));
const MissingAstroCompilerError = new Error((0, utils_js_1.freeText)(`
GraphQL template literals cannot be plucked from a Astro template code without having the "@astrojs/compiler" package installed.
Please install it and try again.
Via NPM:
$ npm install @astrojs/compiler
Via Yarn:
$ yarn add @astrojs/compiler
`));
async function pluckVueFileScript(fileData) {

@@ -184,1 +214,22 @@ let vueTemplateCompiler;

}
async function pluckAstroFileScript(fileData) {
let astroCompiler;
try {
// eslint-disable-next-line import/no-extraneous-dependencies
astroCompiler = await Promise.resolve().then(() => tslib_1.__importStar(require('@astrojs/compiler')));
}
catch (e) {
throw MissingAstroCompilerError;
}
return parseWithAstro(astroCompiler, fileData);
}
function pluckAstroFileScriptSync(fileData) {
let astroCompiler;
try {
astroCompiler = require('astrojs-compiler-sync');
}
catch (e) {
throw MissingAstroCompilerError;
}
return parseWithAstroSync(astroCompiler, fileData);
}

@@ -69,2 +69,5 @@ import { getExtNameFromFilePath } from './libs/extname.js';

break;
case '.astro':
plugins.push('typescript', 'jsx');
break;
default:

@@ -71,0 +74,0 @@ plugins.push('jsx', ...dynamicFlowPlugins);

@@ -26,2 +26,3 @@ import { Source } from 'graphql';

'.svelte',
'.astro',
];

@@ -40,6 +41,17 @@ // tslint:disable-next-line: no-implicit-dependencies

}
// tslint:disable-next-line: no-implicit-dependencies
async function parseWithAstro(astroCompiler, fileData) {
const fileInTsx = await astroCompiler.transform(fileData);
return fileInTsx.code;
}
function parseWithAstroSync(
// tslint:disable-next-line: no-implicit-dependencies
astroCompiler, fileData) {
const fileInTsx = astroCompiler.transform(fileData, undefined);
return fileInTsx.code;
}
/**
* Asynchronously plucks GraphQL template literals from a single file.
*
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`, `.astro`
*

@@ -59,2 +71,5 @@ * @param filePath Path to the file containing the code. Required to detect the file type

}
else if (fileExt === '.astro') {
code = await pluckAstroFileScript(code);
}
return parseCode({ code, filePath, options }).map(t => new Source(t.content, filePath, t.loc.start));

@@ -65,3 +80,3 @@ };

*
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mjs`, `.cjs`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mjs`, `.cjs`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`, `.astro`
*

@@ -81,2 +96,5 @@ * @param filePath Path to the file containing the code. Required to detect the file type

}
else if (fileExt === '.astro') {
code = pluckAstroFileScriptSync(code);
}
return parseCode({ code, filePath, options }).map(t => new Source(t.content, filePath, t.loc.start));

@@ -132,2 +150,14 @@ };

`));
const MissingAstroCompilerError = new Error(freeText(`
GraphQL template literals cannot be plucked from a Astro template code without having the "@astrojs/compiler" package installed.
Please install it and try again.
Via NPM:
$ npm install @astrojs/compiler
Via Yarn:
$ yarn add @astrojs/compiler
`));
async function pluckVueFileScript(fileData) {

@@ -177,1 +207,22 @@ let vueTemplateCompiler;

}
async function pluckAstroFileScript(fileData) {
let astroCompiler;
try {
// eslint-disable-next-line import/no-extraneous-dependencies
astroCompiler = await import('@astrojs/compiler');
}
catch (e) {
throw MissingAstroCompilerError;
}
return parseWithAstro(astroCompiler, fileData);
}
function pluckAstroFileScriptSync(fileData) {
let astroCompiler;
try {
astroCompiler = require('astrojs-compiler-sync');
}
catch (e) {
throw MissingAstroCompilerError;
}
return parseWithAstroSync(astroCompiler, fileData);
}

2

package.json
{
"name": "@graphql-tools/graphql-tag-pluck",
"version": "8.1.0",
"version": "8.2.0-rc-20240122213929-baacb44f7c0da8e192575934b6bcdfd408020825",
"description": "Pluck graphql-tag template literals",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -117,3 +117,3 @@ import { Source } from 'graphql';

*
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`, `.astro`
*

@@ -128,3 +128,3 @@ * @param filePath Path to the file containing the code. Required to detect the file type

*
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mjs`, `.cjs`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`
* Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mjs`, `.cjs`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`, `.astro`
*

@@ -131,0 +131,0 @@ * @param filePath Path to the file containing the code. Required to detect the file type

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