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

@kubb/core

Package Overview
Dependencies
Maintainers
1
Versions
676
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kubb/core - npm Package Compare versions

Comparing version 1.1.8 to 1.1.9

45

dist/index.js
import { createRequire } from 'module';
import crypto from 'node:crypto';
import { promises } from 'node:fs';
import fs from 'fs-extra';
import pathParser2 from 'node:path';

@@ -18,9 +18,9 @@ import { camelCase, camelCaseTransformMerge } from 'change-case';

const passedPath = pathParser2.dirname(pathParser2.resolve(path));
await promises.mkdir(passedPath, { recursive: true });
return promises.writeFile(pathParser2.resolve(path), data, { encoding: "utf-8" });
await fs.mkdir(passedPath, { recursive: true });
return fs.writeFile(pathParser2.resolve(path), data, { encoding: "utf-8" });
}
async function write(data, path) {
try {
await promises.stat(path);
const oldContent = await promises.readFile(path, { encoding: "utf-8" });
await fs.stat(path);
const oldContent = await fs.readFile(path, { encoding: "utf-8" });
if (oldContent?.toString() === data) {

@@ -43,4 +43,5 @@ return;

const item = cache[id];
if (!item)
if (!item) {
return null;
}
item[0] = 0;

@@ -51,4 +52,5 @@ return item[1];

const item = cache[id];
if (!item)
if (!item) {
return false;
}
item[0] = 0;

@@ -63,11 +65,11 @@ return true;

function slash(path, platform = "linux") {
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
if (isExtendedLengthPath || platform === "linux" || platform === "mac") {
return path.replace("../", "").trimEnd();
const isWindowsPath = /^\\\\\?\\/.test(path);
if (["linux", "mac"].includes(platform) && !isWindowsPath) {
return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
}
return path.replace(/\\/g, "/").replace("../", "").trimEnd();
return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
}
function getRelativePath(rootDir, filePath, platform = "linux") {
if (!rootDir || !filePath) {
throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir} ${filePath}`);
throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`);
}

@@ -88,3 +90,3 @@ const relativePath = pathParser2.relative(rootDir, filePath);

async function read(path) {
return promises.readFile(path, { encoding: "utf8" });
return fs.readFile(path, { encoding: "utf8" });
}

@@ -177,5 +179,6 @@

}
async work() {
if (this.workerCount >= this.maxParallel)
work() {
if (this.workerCount >= this.maxParallel) {
return;
}
this.workerCount++;

@@ -650,6 +653,8 @@ let entry;

const plugins = options.config.plugins?.filter((plugin) => trace[1].getFileName()?.includes(plugin.name)).sort((a, b) => {
if (a.name.length < b.name.length)
if (a.name.length < b.name.length) {
return 1;
if (a.name.length > b.name.length)
}
if (a.name.length > b.name.length) {
return -1;
}
return 0;

@@ -826,4 +831,5 @@ });

for (const plugin of this.getSortedPlugins(hookName)) {
if (skipped && skipped.has(plugin))
if (skipped && skipped.has(plugin)) {
continue;
}
promise = promise.then(async (parseResult) => {

@@ -858,4 +864,5 @@ if (parseResult?.result != null) {

for (const plugin of this.getSortedPlugins(hookName)) {
if (skipped && skipped.has(plugin))
if (skipped && skipped.has(plugin)) {
continue;
}
parseResult = {

@@ -862,0 +869,0 @@ result: this.executeSync({

{
"name": "@kubb/core",
"version": "1.1.8",
"version": "1.1.9",
"description": "Generator core",

@@ -45,6 +45,9 @@ "keywords": [

"directory-tree": "^3.5.1",
"graceful-fs": "^4.2.11",
"fs-extra": "^11.1.1",
"rimraf": "^5.0.1",
"@kubb/ts-codegen": "1.1.8"
"@kubb/ts-codegen": "1.1.9"
},
"devDependencies": {
"@types/fs-extra": "^11.0.1",
"eslint": "^8.42.0",

@@ -54,5 +57,5 @@ "ora": "^6.3.1",

"typescript": "^5.1.3",
"@kubb/eslint-config": "0.1.0",
"@kubb/tsup-config": "0.1.0",
"@kubb/typescript-config": "0.1.0"
"@kubb/eslint-config": "1.1.8",
"@kubb/ts-config": "0.1.0",
"@kubb/tsup-config": "1.1.8"
},

@@ -71,3 +74,3 @@ "packageManager": "pnpm@8.3.0",

"clean": "rimraf ./dist",
"lint": "eslint \"**/*.{ts,tsx}\"",
"lint": "ESLINT_USE_FLAT_CONFIG=true eslint \"**/*.{ts,tsx}\"",
"lint-fix": "eslint \"**/*.{ts,tsx}\" --quiet --fix",

@@ -74,0 +77,0 @@ "release": "pnpm publish --no-git-check",

@@ -1,2 +0,1 @@

/* eslint-disable no-async-promise-executor */
import { getFileSource } from './managers/fileManager/index.ts'

@@ -26,2 +25,3 @@ import { PluginManager } from './managers/pluginManager/index.ts'

result: TransformResult | Promise<TransformResult>,
_plugin: KubbPlugin

@@ -28,0 +28,0 @@ ): Promise<string | null> {

@@ -1,2 +0,1 @@

/* eslint-disable @typescript-eslint/no-empty-interface */
import { build } from './build.ts'

@@ -3,0 +2,0 @@

/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable no-await-in-loop */
/* eslint-disable no-restricted-syntax */

@@ -163,6 +161,8 @@ import { definePlugin } from '../../plugin.ts'

}): Promise<SafeParseResult<H>> {
let promise: Promise<SafeParseResult<H>> = Promise.resolve(null as any)
let promise: Promise<SafeParseResult<H>> = Promise.resolve(null as unknown as SafeParseResult<H>)
for (const plugin of this.getSortedPlugins(hookName)) {
if (skipped && skipped.has(plugin)) continue
if (skipped && skipped.has(plugin)) {
continue
}
promise = promise.then(async (parseResult) => {

@@ -205,3 +205,5 @@ if (parseResult?.result != null) {

for (const plugin of this.getSortedPlugins(hookName)) {
if (skipped && skipped.has(plugin)) continue
if (skipped && skipped.has(plugin)) {
continue
}

@@ -376,6 +378,6 @@ parseResult = {

if (typeof hook === 'function') {
const hookResult = (hook as Function).apply(this.core.api, parameters)
const hookResult = (hook as Function).apply(this.core.api, parameters) as TResult
if (isPromise(hookResult)) {
return Promise.resolve(hookResult).then((result) => {
return Promise.resolve(hookResult).then((result: TResult) => {
this.addExecuter({

@@ -439,5 +441,4 @@ strategy,

// eslint-disable-next-line @typescript-eslint/ban-types
if (typeof hook === 'function') {
const fn = (hook as Function).apply(this.core.api, parameters)
const fn = (hook as Function).apply(this.core.api, parameters) as ReturnType<ParseResult<H>>

@@ -444,0 +445,0 @@ this.addExecuter({

@@ -59,4 +59,8 @@ import pathParser from 'node:path'

.sort((a, b) => {
if (a.name.length < b.name.length) return 1
if (a.name.length > b.name.length) return -1
if (a.name.length < b.name.length) {
return 1
}
if (a.name.length > b.name.length) {
return -1
}
return 0

@@ -63,0 +67,0 @@ })

@@ -1,4 +0,1 @@

/* eslint-disable no-param-reassign */
/* eslint-disable consistent-return */
export interface Cache<T extends object = object> {

@@ -18,3 +15,5 @@ delete(id: keyof T): boolean

const item = cache[id]
if (!item) return null
if (!item) {
return null
}
item[0] = 0

@@ -25,3 +24,5 @@ return item[1] as T[keyof T]

const item = cache[id]
if (!item) return false
if (!item) {
return false
}
item[0] = 0

@@ -28,0 +29,0 @@ return true

@@ -1,2 +0,3 @@

// eslint-disable-next-line @typescript-eslint/ban-types, no-undef
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
// eslint-disable-next-line @typescript-eslint/ban-types
export function getStackTrace(belowFn?: Function): NodeJS.CallSite[] {

@@ -18,3 +19,3 @@ const oldLimit = Error.stackTraceLimit

return v8StackTrace
return v8StackTrace as NodeJS.CallSite[]
}

@@ -1,2 +0,1 @@

/* eslint-disable no-param-reassign */
export function getUniqueName(originalName: string, data: Record<string, number>) {

@@ -3,0 +2,0 @@ let used = data[originalName] || 0

@@ -1,3 +0,1 @@

/* eslint-disable no-cond-assign */
export type QueueTask<T = unknown> = {

@@ -32,4 +30,6 @@ (...args: unknown[]): Promise<T>

private async work(): Promise<void> {
if (this.workerCount >= this.maxParallel) return
private work(): void {
if (this.workerCount >= this.maxParallel) {
return
}
this.workerCount++

@@ -36,0 +36,0 @@

@@ -1,14 +0,14 @@

import { promises as fs } from 'node:fs'
import pathParser from 'node:path'
import fs from 'fs-extra'
function slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {
const isExtendedLengthPath = /^\\\\\?\\/.test(path)
const isWindowsPath = /^\\\\\?\\/.test(path)
if (isExtendedLengthPath || platform === 'linux' || platform === 'mac') {
if (['linux', 'mac'].includes(platform) && !isWindowsPath) {
// linux and mac
return path.replace('../', '').trimEnd()
return path.replaceAll(/\\/g, '/').replace('../', '').trimEnd()
}
// windows
return path.replace(/\\/g, '/').replace('../', '').trimEnd()
return path.replaceAll(/\\/g, '/').replace('../', '').trimEnd()
}

@@ -18,3 +18,3 @@

if (!rootDir || !filePath) {
throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir} ${filePath}`)
throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)
}

@@ -21,0 +21,0 @@

@@ -1,3 +0,2 @@

/* eslint-disable consistent-return */
import { promises as fs } from 'node:fs'
import fs from 'fs-extra'
import pathParser from 'node:path'

@@ -4,0 +3,0 @@

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