Update package dependencies and remove unused files from node_modules
This commit is contained in:
22
node_modules/vitefu/src/index.js
generated
vendored
22
node_modules/vitefu/src/index.js
generated
vendored
@@ -1,6 +1,5 @@
|
||||
import fs from 'node:fs/promises'
|
||||
import fsSync from 'node:fs'
|
||||
import { createRequire } from 'node:module'
|
||||
import path from 'node:path'
|
||||
import {
|
||||
isDepIncluded,
|
||||
@@ -13,20 +12,25 @@ import {
|
||||
let pnp
|
||||
if (process.versions.pnp) {
|
||||
try {
|
||||
const { createRequire } = (await import('module')).default
|
||||
pnp = createRequire(import.meta.url)('pnpapi')
|
||||
} catch {}
|
||||
}
|
||||
|
||||
export { isDepIncluded, isDepExcluded, isDepNoExternaled, isDepExternaled }
|
||||
|
||||
/** @type {import('./index.d.ts').crawlFrameworkPkgs} */
|
||||
/** @type {import('..').crawlFrameworkPkgs} */
|
||||
export async function crawlFrameworkPkgs(options) {
|
||||
const pkgJsonPath = await findClosestPkgJsonPath(options.root)
|
||||
if (!pkgJsonPath) {
|
||||
// don't throw as package.json is not required
|
||||
return {
|
||||
optimizeDeps: { include: [], exclude: [] },
|
||||
ssr: { noExternal: [], external: [] }
|
||||
// @ts-expect-error don't throw in deno as package.json is not required
|
||||
if (typeof Deno !== 'undefined') {
|
||||
return {
|
||||
optimizeDeps: { include: [], exclude: [] },
|
||||
ssr: { noExternal: [], external: [] }
|
||||
}
|
||||
} else {
|
||||
throw new Error(`Cannot find package.json from ${options.root}`)
|
||||
}
|
||||
}
|
||||
const pkgJson = await readJson(pkgJsonPath).catch((e) => {
|
||||
@@ -189,7 +193,7 @@ export async function crawlFrameworkPkgs(options) {
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {import('./index.d.ts').findDepPkgJsonPath} */
|
||||
/** @type {import('..').findDepPkgJsonPath} */
|
||||
export async function findDepPkgJsonPath(dep, parent) {
|
||||
if (pnp) {
|
||||
try {
|
||||
@@ -217,7 +221,7 @@ export async function findDepPkgJsonPath(dep, parent) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
/** @type {import('./index.d.ts').findClosestPkgJsonPath} */
|
||||
/** @type {import('..').findClosestPkgJsonPath} */
|
||||
export async function findClosestPkgJsonPath(dir, predicate = undefined) {
|
||||
if (dir.endsWith('package.json')) {
|
||||
dir = path.dirname(dir)
|
||||
@@ -237,7 +241,7 @@ export async function findClosestPkgJsonPath(dir, predicate = undefined) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
/** @type {import('./index.d.ts').pkgNeedsOptimization} */
|
||||
/** @type {import('..').pkgNeedsOptimization} */
|
||||
export async function pkgNeedsOptimization(pkgJson, pkgJsonPath) {
|
||||
// only optimize if is cjs, using the below as heuristic
|
||||
// see https://github.com/sveltejs/vite-plugin-svelte/issues/162
|
||||
|
Reference in New Issue
Block a user