Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: lts/*
cache: pnpm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: pnpm build

- name: Run benchmarks
uses: CodSpeedHQ/action@9a74b6ba663684052277e8f342b5eb99c7442a03 # v4.10.5
uses: CodSpeedHQ/action@281164b0f014a4e7badd2c02cecad9b595b70537 # v4.11.1
with:
run: pnpm vitest bench
mode: instrumentation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: lts/*
cache: pnpm
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: lts/*
cache: pnpm
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: lts/-1
cache: pnpm
Expand All @@ -55,7 +55,7 @@ jobs:
bun-version: latest
- uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2
with:
deno-version: 2.6.8
deno-version: 2.7.4

- name: 📦 Install dependencies
run: pnpm install
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: latest
cache: pnpm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/size-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- run: corepack enable
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: lts/*

Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
with:
ref: ${{ github.base_ref }}
- run: corepack enable
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: lts/*

Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nuxi-workspace",
"type": "module",
"private": true,
"packageManager": "pnpm@10.29.1",
"packageManager": "pnpm@10.32.0",
"description": "⚡️ Nuxt Generation CLI Experience",
"license": "MIT",
"repository": "nuxt/cli",
Expand All @@ -21,36 +21,36 @@
"test:unit": "vitest --coverage --run && pnpm --filter nuxt-cli-playground test --run"
},
"devDependencies": {
"@antfu/eslint-config": "^7.3.0",
"@codspeed/vitest-plugin": "^5.1.0",
"@nuxt/eslint-config": "^1.14.0",
"@antfu/eslint-config": "^7.7.0",
"@codspeed/vitest-plugin": "^5.2.0",
"@nuxt/eslint-config": "^1.15.2",
"@nuxt/nitro-server": "^4.3.1",
"@nuxt/test-utils": "^4.0.0",
"@types/node": "^24.10.12",
"@types/node": "^24.12.0",
"@types/semver": "^7.7.1",
"@vitest/coverage-v8": "^4.0.18",
"changelogen": "^0.6.2",
"eslint": "^10.0.0",
"eslint": "^10.0.3",
"exsolve": "^1.0.8",
"knip": "^5.83.1",
"knip": "^5.86.0",
"nuxt": "^4.3.1",
"pkg-pr-new": "^0.0.63",
"pkg-pr-new": "^0.0.65",
"semver": "^7.7.4",
"std-env": "^3.10.0",
"tinyexec": "^1.0.2",
"typescript": "^5.9.3",
"vitest": "^4.0.18",
"vue": "^3.5.27",
"vue-router": "^5.0.2"
"vue": "^3.5.30",
"vue-router": "^5.0.3"
},
"resolutions": {
"@nuxt/cli": "workspace:*",
"@nuxt/schema": "4.3.1",
"create-nuxt": "workspace:*",
"create-nuxt-app": "workspace:*",
"eslint-plugin-jsdoc": "62.5.4",
"eslint-plugin-jsdoc": "62.7.1",
"eslint-plugin-unicorn": "63.0.0",
"h3": "^1.15.5",
"h3": "^1.15.6",
"nitropack": "latest",
"nuxi": "workspace:*"
}
Expand Down
10 changes: 5 additions & 5 deletions packages/create-nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"prepack": "tsdown"
},
"dependencies": {
"citty": "^0.2.0"
"citty": "^0.2.1"
},
"devDependencies": {
"@bomb.sh/tab": "^0.0.12",
"@types/node": "^24.10.12",
"rollup": "^4.57.1",
"rollup-plugin-visualizer": "^7.0.0",
"@bomb.sh/tab": "^0.0.14",
"@types/node": "^24.12.0",
"rollup": "^4.59.0",
"rollup-plugin-visualizer": "^7.0.1",
"tsdown": "^0.20.3",
"typescript": "^5.9.3",
"unplugin-purge-polyfills": "^0.1.0"
Expand Down
22 changes: 11 additions & 11 deletions packages/nuxi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
"test:dist": "node ./bin/nuxi.mjs info ../../playground"
},
"devDependencies": {
"@bomb.sh/tab": "^0.0.12",
"@clack/prompts": "^1.0.0",
"@bomb.sh/tab": "^0.0.14",
"@clack/prompts": "^1.1.0",
"@nuxt/kit": "^4.3.1",
"@nuxt/schema": "^4.3.1",
"@nuxt/test-utils": "^4.0.0",
"@types/debug": "^4.1.12",
"@types/node": "^24.10.12",
"@types/node": "^24.12.0",
"@types/semver": "^7.7.1",
"c12": "^3.3.3",
"citty": "^0.2.0",
"citty": "^0.2.1",
"confbox": "^0.2.4",
"consola": "^3.4.2",
"debug": "^4.4.3",
Expand All @@ -51,8 +51,8 @@
"fuse.js": "^7.1.0",
"fzf": "^0.5.2",
"giget": "^3.1.2",
"h3": "^1.15.5",
"h3-next": "npm:h3@^2.0.1-rc.14",
"h3": "^1.15.6",
"h3-next": "npm:h3@^2.0.1-rc.16",
"jiti": "^2.6.1",
"listhen": "^1.9.0",
"magicast": "^0.5.2",
Expand All @@ -64,19 +64,19 @@
"pathe": "^2.0.3",
"perfect-debounce": "^2.1.0",
"pkg-types": "^2.3.0",
"rollup": "^4.57.1",
"rollup-plugin-visualizer": "^7.0.0",
"rollup": "^4.59.0",
"rollup-plugin-visualizer": "^7.0.1",
"scule": "^1.3.0",
"semver": "^7.7.4",
"srvx": "^0.11.2",
"srvx": "^0.11.9",
"std-env": "^3.10.0",
"tinyclip": "^0.1.10",
"tinyclip": "^0.1.12",
"tinyexec": "^1.0.2",
"tsdown": "^0.20.3",
"typescript": "^5.9.3",
"ufo": "^1.6.3",
"unplugin-purge-polyfills": "^0.1.0",
"vitest": "^4.0.18",
"youch": "^4.1.0-beta.13"
"youch": "^4.1.0"
}
}
4 changes: 3 additions & 1 deletion packages/nuxi/src/commands/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { logger } from '../utils/logger'
import { relativeToProcess } from '../utils/paths'
import { cwdArgs, dotEnvArgs, extendsArgs, legacyRootDirArgs, logLevelArgs } from './_shared'

const NON_WORD_RE = /[^\w-]/g

const indexHtml = `
<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -66,7 +68,7 @@ export default defineCommand({

const cwd = resolve(ctx.args.cwd || ctx.args.rootDir)
const name = ctx.args.name || 'default'
const slug = name.trim().replace(/[^\w-]/g, '_')
const slug = name.trim().replace(NON_WORD_RE, '_')

intro(colors.cyan('Analyzing bundle size...'))

Expand Down
4 changes: 3 additions & 1 deletion packages/nuxi/src/commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { logger } from '../utils/logger'
import { getPackageManagerVersion } from '../utils/packageManagers'
import { cwdArgs, legacyRootDirArgs } from './_shared'

const LEADING_SLASH_RE = /^\//

export default defineCommand({
meta: {
name: 'info',
Expand Down Expand Up @@ -191,7 +193,7 @@ function normalizeConfigModule(
.pop()! // Strip rootDir
.split('node_modules')
.pop()! // Strip node_modules
.replace(/^\//, '')
.replace(LEADING_SLASH_RE, '')
}
if (typeof module === 'function') {
return `${module.name}()`
Expand Down
12 changes: 8 additions & 4 deletions packages/nuxi/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import { selectModulesAutocomplete } from './module/_autocomplete'
import { checkNuxtCompatibility, fetchModules } from './module/_utils'
import addModuleCommand from './module/add'

const NON_WORD_RE = /[^\w-]/g
const MULTI_DASH_RE = /-{2,}/g
const LEADING_TRAILING_DASH_RE = /^-|-$/g

const DEFAULT_REGISTRY = 'https://raw.githubusercontent.com/nuxt/starter/templates/templates'
const DEFAULT_TEMPLATE_NAME = 'minimal'

Expand Down Expand Up @@ -256,9 +260,9 @@ export default defineCommand({
const pkg = await readPackageJSON(path, { try: true })
if (pkg && pkg.name) {
const slug = basename(templateDownloadPath)
.replace(/[^\w-]/g, '-')
.replace(/-{2,}/g, '-')
.replace(/^-|-$/g, '')
.replace(NON_WORD_RE, '-')
.replace(MULTI_DASH_RE, '-')
.replace(LEADING_TRAILING_DASH_RE, '')
if (slug) {
pkg.name = slug
await writePackageJSON(path, pkg)
Expand Down Expand Up @@ -585,7 +589,7 @@ async function getTemplateDependencies(templateDir: string) {
deps.forEach(dep => allDeps.add(dep))
})

return Array.from(allDeps)
return [...allDeps]
}
catch (err) {
logger.warn(`Could not read template dependencies: ${err}`)
Expand Down
6 changes: 4 additions & 2 deletions packages/nuxi/src/commands/module/_autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { hasTTY } from 'std-env'

import { logger } from '../../utils/logger'

const TRAILING_DOT_RE = /\.$/

interface AutocompleteOptions {
modules: NuxtModule[]
message?: string
Expand All @@ -30,7 +32,7 @@ export async function selectModulesAutocomplete(options: AutocompleteOptions): P
}

// Sort: official modules first, then alphabetically
const sortedModules = [...modules].sort((a, b) => {
const sortedModules = modules.toSorted((a, b) => {
if (a.type === 'official' && b.type !== 'official')
return -1
if (a.type !== 'official' && b.type === 'official')
Expand All @@ -49,7 +51,7 @@ export async function selectModulesAutocomplete(options: AutocompleteOptions): P
const clackOptions: Option<string>[] = sortedModules.map(m => ({
value: m.npm,
label: m.npm,
hint: m.description.replace(/\.$/, ''),
hint: m.description.replace(TRAILING_DOT_RE, ''),
}))

// Custom filter function using fzf for fuzzy matching
Expand Down
9 changes: 7 additions & 2 deletions packages/nuxi/src/commands/module/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import { existsSync } from 'node:fs'
import { homedir } from 'node:os'
import { join } from 'node:path'

import process from 'node:process'

import { cancel, confirm, isCancel, select, spinner } from '@clack/prompts'
import { updateConfig } from 'c12/update'
import { defineCommand } from 'citty'
Expand All @@ -28,6 +28,10 @@
import { selectModulesAutocomplete } from './_autocomplete'
import { checkNuxtCompatibility, fetchModules, getRegistryFromContent } from './_utils'

const PROTOCOL_RE = /^https?:\/\//
const TRAILING_SLASH_RE = /\/$/
const REGEX_SPECIAL_RE = /[.*+?^${}()|[\]\\]/g

interface RegistryMeta {
registry: string
authToken: string | null
Expand Down Expand Up @@ -400,7 +404,8 @@

async function getAuthToken(registry: RegistryMeta['registry']): Promise<RegistryMeta['authToken']> {
const paths = getNpmrcPaths()
const authTokenRegex = new RegExp(`^//${registry.replace(/^https?:\/\//, '').replace(/\/$/, '')}/:_authToken=(.+)$`, 'm')
const registryHost = registry.replace(PROTOCOL_RE, '').replace(TRAILING_SLASH_RE, '').replace(REGEX_SPECIAL_RE, '\\$&')
const authTokenRegex = new RegExp(`^//${registryHost}/:_authToken=(.+)$`, 'm')

for (const npmrcPath of paths) {
let fd: FileHandle | undefined
Expand Down Expand Up @@ -441,7 +446,7 @@
return process.env.COREPACK_NPM_REGISTRY
}
const registry = await getRegistryFromFile(getNpmrcPaths(), scope)

Check failure

Code scanning / CodeQL

Incomplete regular expression for hostnames High

This string, which is used as a regular expression
here
, has an unescaped '.' before 'npmjs.org', so it might match more hosts than expected.
if (registry) {
process.env.COREPACK_NPM_REGISTRY = registry
}
Expand Down
4 changes: 3 additions & 1 deletion packages/nuxi/src/commands/module/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { getNuxtVersion } from '../../utils/versions'
import { cwdArgs } from '../_shared'
import { checkNuxtCompatibility, fetchModules } from './_utils'

const DASH_RE = /-/g

const { format: formatNumber } = Intl.NumberFormat('en-GB', {
notation: 'compact',
maximumFractionDigits: 1,
Expand Down Expand Up @@ -94,7 +96,7 @@ async function findModuleByKeywords(query: string, nuxtVersion: string) {
for (const foundModule of results) {
const formattedModule: Record<string, string> = {}
for (const [key, val] of Object.entries(foundModule)) {
const label = upperFirst(kebabCase(key)).replace(/-/g, ' ')
const label = upperFirst(kebabCase(key)).replace(DASH_RE, ' ')
formattedModule[label] = val
}
const title = formattedModule.Name || formattedModule.Package
Expand Down
7 changes: 5 additions & 2 deletions packages/nuxi/src/utils/formatting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import process from 'node:process'
import { stripVTControlCharacters } from 'node:util'
import { colors } from 'consola/utils'

const AT_MENTION_RE = /\b@([^, ]+)/g
const BACKTICK_RE = /`([^`]*)`/g

function getStringWidth(str: string): number {
const stripped = stripVTControlCharacters(str)
let width = 0
Expand Down Expand Up @@ -55,8 +58,8 @@ export function formatInfoBox(infoObj: Record<string, string | undefined>): stri
let boxStr = ''
for (const [label, value] of entries) {
const formattedValue = value
.replace(/\b@([^, ]+)/g, (_, r) => colors.gray(` ${r}`))
.replace(/`([^`]*)`/g, (_, r) => r)
.replace(AT_MENTION_RE, (_, r) => colors.gray(` ${r}`))
.replace(BACKTICK_RE, (_, r) => r)

boxStr += (`${colors.bold(colors.whiteBright(label))}`).padEnd(ansiFirstColumnLength)

Expand Down
Loading
Loading