feat(kit,nuxt,vite,webpack): support `-nightly` extension (#23508)

This commit is contained in:
Daniel Roe 2023-10-12 15:17:38 +01:00 committed by GitHub
parent 2e02e2c5b1
commit eb40409f23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 26 additions and 23 deletions

View File

@ -61,5 +61,5 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `:rocket: Release triggered! You can now install [nuxt@npm:nuxt3@pr-${{ github.event.issue.number }}](https://www.npmjs.com/package/nuxt3/v/pr-${{ github.event.issue.number }})`
body: `:rocket: Release triggered! You can now install [nuxt@npm:nuxt-nightly@pr-${{ github.event.issue.number }}](https://www.npmjs.com/package/nuxt-nightly/v/pr-${{ github.event.issue.number }})`
})

View File

@ -1,23 +1,23 @@
---
title: "Edge Channel"
description: "Edge channel allows to use latest commits from the repository."
title: "Nightly Release Channel"
description: "The nightly release channel allows using Nuxt built directly from the latest commits to the repository."
---
# Edge Release Channel
# Nightly Release Channel
Nuxt 3 is landing commits, improvements, and bug fixes every day. You can opt-in to test them earlier before the next release.
Nuxt lands commits, improvements, and bug fixes every day. You can opt in to test them earlier before the next release.
After each commit is merged into the `main` branch of [nuxt/nuxt](https://github.com/nuxt/nuxt) and **passing all tests**, we trigger an automated npm release using GitHub Actions publishing Nuxt 3 packages.
After a commit is merged into the `main` branch of [nuxt/nuxt](https://github.com/nuxt/nuxt) and **passes all tests**, we trigger an automated npm release, using GitHub Actions.
You can opt in to use this release channel and avoid waiting for the next release and helping Nuxt by beta testing changes.
You can use these 'nightly' releases to beta test new features and changes.
The build and publishing method and quality of edge releases are the same as stable ones. The only difference is that you should often check the GitHub repository for updates. There is a slight chance of regressions not being caught during the review process and by the automated tests. Therefore, we internally use this channel to double-check everything before each release.
The build and publishing method and quality of these 'nightly' releases are the same as stable ones. The only difference is that you should often check the GitHub repository for updates. There is a slight chance of regressions not being caught during the review process and by the automated tests. Therefore, we internally use this channel to double-check everything before each release.
:::Alert
Features only available on the edge channel are marked with an alert in the documentation.
Features that are only available on the nightly release channel are marked with an alert in the documentation.
:::
## Opting Into the Edge Channel
## Opting Into the Nightly Release Channel
Update `nuxt` dependency inside `package.json`:
@ -25,21 +25,21 @@ Update `nuxt` dependency inside `package.json`:
{
"devDependencies": {
-- "nuxt": "^3.0.0"
++ "nuxt": "npm:nuxt3@latest"
++ "nuxt": "npm:nuxt-nightly@latest"
}
}
```
Remove lockfile (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, or `bun.lockb`) and reinstall dependencies.
## Opting Out From the Edge Channel
## Opting Out From the Nightly Release Channel
Update `nuxt` dependency inside `package.json`:
```diff [package.json]
{
"devDependencies": {
-- "nuxt": "npm:nuxt3@latest"
-- "nuxt": "npm:nuxt-nightly@latest"
++ "nuxt": "^3.0.0"
}
}
@ -47,10 +47,10 @@ Update `nuxt` dependency inside `package.json`:
Remove lockfile (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, or `bun.lockb`) and reinstall dependencies.
## Using Latest `nuxi` CLI From Edge
## Using Latest `nuxi` CLI From Nightly Release
:::Alert
All cli dependencies are bundled because of the building method for reducing `nuxi` package size. You can get dependency updates and CLI improvements using the edge channel.
All cli dependencies are bundled because of the building method for reducing `nuxi` package size. You can get dependency updates and CLI improvements using the nightly release channel.
:::
You can use `npx nuxi-edge@latest [command]` to try the latest version of the nuxi CLI.

View File

@ -26,7 +26,7 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
// Apply dev as config override
opts.overrides.dev = !!opts.dev
const nearestNuxtPkg = await Promise.all(['nuxt3', 'nuxt', 'nuxt-edge']
const nearestNuxtPkg = await Promise.all(['nuxt-nightly', 'nuxt3', 'nuxt', 'nuxt-edge']
.map(pkg => resolvePackageJSON(pkg, { url: opts.cwd }).catch(() => null)))
.then(r => (r.filter(Boolean) as string[]).sort((a, b) => b.length - a.length)[0])
if (!nearestNuxtPkg) {
@ -75,7 +75,7 @@ export async function buildNuxt (nuxt: Nuxt): Promise<any> {
// Nuxt 3
if (nuxt.options._majorVersion === 3) {
const { build } = await tryImportModule('nuxt3', rootDir) || await importModule('nuxt', rootDir)
const { build } = await tryImportModule('nuxt-nightly', rootDir) || await tryImportModule('nuxt3', rootDir) || await importModule('nuxt', rootDir)
return build(nuxt)
}

View File

@ -155,6 +155,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
...nuxt.options.build.transpile.filter((i): i is string => typeof i === 'string'),
'nuxt/dist',
'nuxt3/dist',
'nuxt-nightly/dist',
distDir
],
traceInclude: [

View File

@ -14,7 +14,7 @@ interface ImportProtectionOptions {
}
export const vueAppPatterns = (nuxt: Nuxt) => [
[/^(nuxt3|nuxt)$/, '`nuxt3`/`nuxt` cannot be imported directly. Instead, import runtime Nuxt composables from `#app` or `#imports`.'],
[/^(nuxt|nuxt3|nuxt-nightly)$/, '`nuxt`/`nuxt3`/`nuxt-nightly` cannot be imported directly. Instead, import runtime Nuxt composables from `#app` or `#imports`.'],
[/^((|~|~~|@|@@)\/)?nuxt\.config(\.|$)/, 'Importing directly from a `nuxt.config` file is not allowed. Instead, use runtime config or a module.'],
[/(^|node_modules\/)@vue\/composition-api/],
...nuxt.options.modules.filter(m => typeof m === 'string').map((m: any) =>

View File

@ -11,6 +11,7 @@ const testsToTriggerOn = [
['.nuxt/nuxt.config', 'app.vue', false],
['nuxt', 'components/Component.vue', true],
['nuxt3', 'components/Component.vue', true],
['nuxt-nightly', 'components/Component.vue', true],
['/root/node_modules/@vue/composition-api', 'components/Component.vue', true],
['@vue/composition-api', 'components/Component.vue', true],
['@nuxt/kit', 'components/Component.vue', true],

View File

@ -18,7 +18,7 @@ interface ComposableKeysOptions {
}
const stringTypes = ['Literal', 'TemplateLiteral']
const NUXT_LIB_RE = /node_modules\/nuxt3?\//
const NUXT_LIB_RE = /node_modules\/(nuxt|nuxt3|nuxt-nightly)\//
const SUPPORTED_EXT_RE = /\.(m?[jt]sx?|vue)/
export const composableKeysPlugin = createUnplugin((options: ComposableKeysOptions) => {

View File

@ -68,7 +68,7 @@ export async function buildServer (ctx: ViteBuildContext) {
'/__vue-jsx',
'#app',
/^nuxt(\/|$)/,
/(nuxt|nuxt3)\/(dist|src|app)/
/(nuxt|nuxt3|nuxt-nightly)\/(dist|src|app)/
]
},
cacheDir: resolve(ctx.nuxt.options.rootDir, 'node_modules/.cache/vite', 'server'),

View File

@ -118,7 +118,7 @@ function createViteNodeApp (ctx: ViteBuildContext, invalidates: Set<string> = ne
const node: ViteNodeServer = new ViteNodeServer(viteServer, {
deps: {
inline: [
/\/node_modules\/(.*\/)?(nuxt|nuxt3)\//,
/\/node_modules\/(.*\/)?(nuxt|nuxt3|nuxt-nightly)\//,
/^#/,
...transpile({ isServer: true, isDev: ctx.nuxt.options.dev })
]

View File

@ -47,6 +47,7 @@ function serverStandalone (ctx: WebpackConfigContext) {
'#app',
'nuxt',
'nuxt3',
'nuxt-nightly',
'!',
'-!',
'~',

View File

@ -6,7 +6,7 @@ import { determineBumpType, loadWorkspace } from './_utils'
const nightlyPackages = {
nitropack: 'nitropack-edge',
h3: 'h3-nightly',
nuxi: 'nuxi-edge'
nuxi: 'nuxi-nightly'
}
async function main () {
@ -27,7 +27,7 @@ async function main () {
pkg.data.dependencies[name] = `npm:${nightlyName}@latest`
}
}
const newname = pkg.data.name === 'nuxt' ? 'nuxt3' : (pkg.data.name + '-edge')
const newname = pkg.data.name + '-nightly'
workspace.rename(pkg.data.name, newname)
}