Skip to content

Commit 64dfecc

Browse files
committed
feat: initial rewrite for nuxt 3 support
1 parent a05bbe9 commit 64dfecc

96 files changed

Lines changed: 3277 additions & 11206 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
8+
branches:
9+
- dev
10+
11+
jobs:
12+
ci:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- run: corepack enable
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 16
20+
cache: "yarn"
21+
- run: yarn install
22+
- run: yarn lint
23+
- run: yarn build
24+
# - run: yarn vitest --coverage
25+
# - uses: codecov/codecov-action@v3

.github/workflows/e2e.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/unit.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ coverage
88
sw.*
99
.vscode
1010
.vercel_build_output
11+
.output

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Nuxt.js
3+
Copyright (c) 2020-Present Nuxt Project
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@
88
- [📖  Read Documentation](https://image.nuxtjs.org)
99
- [▶️  Play online](https://githubbox.com/nuxt/image/tree/main/example)
1010

11+
**Note:** This branch is for Nuxt 3 compatible module. Checkout [`v0` branch](https://github.com/nuxt/bridge/tree/v0) for Nuxt 2 support.
1112

1213
### Contributing
1314

1415
1. Clone this repository
1516
2. Install dependencies using `yarn install`
1617
3. Start development server using `yarn dev`
1718

18-
1919
## 📑 License
2020

21-
Copyright (c) Nuxt Team
22-
23-
21+
Published under the [MIT License](./LICENSE)
2422

2523
<!-- Badges -->
2624
[npm-version-src]: https://flat.badgen.net/npm/v/@nuxt/image

build.config.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
import { defineBuildConfig } from 'unbuild'
22

33
export default defineBuildConfig({
4-
declaration: true,
5-
rollup: {
6-
emitCJS: true
7-
},
8-
entries: [
9-
{ input: './src/runtime/', outDir: 'dist/runtime', ext: 'js' },
10-
'./src/module'
11-
],
124
externals: [
13-
'ipx',
14-
'@nuxt/types'
5+
'ipx'
156
]
167
})

docs/content/1.getting-started/1.installation.md

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: Installation
3-
description: Using image module in your Nuxt 2 project is only one command away. ✨
3+
description: Using image module in your Nuxt project is only one command away. ✨
44
---
55

66
::alert{type="info"}
7-
Image module only works with Nuxt 2 and is not compatible with Nuxt 3, yet. Track the progress in [this issue](https://github.com/nuxt/image/issues/500).
7+
Nuxt 3 support is experimental. Please check [v0](https://image.nuxtjs.org/) documentation for Nuxt 2 compatible version.
88
::
99

10-
Add `@nuxt/image` devDependency to your project:
10+
Add `@nuxt/image-edge` as a devDependency to your project:
1111

1212
::code-group
1313
```bash [yarn]
@@ -21,21 +21,10 @@ Add `@nuxt/image` devDependency to your project:
2121

2222
Add the module to `buildModules` in your `nuxt.config`:
2323

24-
```ts [nuxt.config.js]
25-
export default {
26-
target: 'static',
27-
buildModules: [
28-
'@nuxt/image',
29-
]
30-
}
31-
```
32-
33-
If you use `server` target (default) and are using the default provider, add `@nuxt/image` to `modules` section instead:
34-
3524
```ts [nuxt.config.js]
3625
export default {
3726
modules: [
38-
'@nuxt/image',
27+
'@nuxt/image-edge',
3928
]
4029
}
4130
```
@@ -58,29 +47,11 @@ export default {
5847

5948
See [module options](/api/options) for available options.
6049

61-
## TypeScript
62-
63-
If you're using Typescript, add the types to your "types" array in `tsconfig.json` after the `@nuxt/types` (Nuxt 2.9.0+) or `@nuxt/vue-app` entry.
64-
65-
```json [tsconfig.json]
66-
{
67-
"compilerOptions": {
68-
"types": ["@nuxt/types", "@nuxt/image"]
69-
}
70-
}
71-
```
72-
73-
## Upgrading
74-
75-
::alert{type="warning"}
76-
Behavior and API changes might happen in 0.x releases of image module. Update with caution.
77-
::
78-
7950
## Troubleshooting
8051

8152
If an error occurs during installation:
8253

83-
- Ensure using LTS version of NodeJS or latest update of `12.x`, `14.x` or `16.x` ([NodeJS Downloads page](https://nodejs.org/en/download/))
54+
- Ensure using LTS version of NodeJS ([NodeJS Downloads page](https://nodejs.org/en/download/))
8455

8556
- Try to upgrade to latest versions:
8657

docs/content/1.getting-started/2.providers.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ The default provider for Nuxt Image is [ipx](/providers/ipx) or [static](/gettin
1919

2020
### Local Images
2121

22-
Images should be stored in the `static/` directory of your project.
22+
Images should be stored in the `public/` directory of your project.
2323

24-
For example, when using `<nuxt-img src="/nuxt-icon.png" />`, it should be placed in `static/` folder under the path `static/nuxt-icon.png`.
24+
For example, when using `<nuxt-img src="/nuxt-icon.png" />`, it should be placed in `public/` folder under the path `public/nuxt-icon.png`.
2525

26-
Image stored in the `assets/` directory are **not** proccessed with Nuxt Image because those images are managed by webpack.
26+
For more information, you can learn more about the [public directory](https://v3.nuxtjs.org/guide/directory-structure/public).
2727

28-
For more information, you can learn more about the [static directory here](https://nuxtjs.org/docs/2.x/directory-structure/static).
28+
::alert{type="warning"}
29+
Image stored in the `assets/` directory are **not** proccessed with Nuxt Image because those images are managed by webpack.
30+
::
2931

3032
### Remote Images
3133

docs/content/1.getting-started/3.static.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: Static Images
33
description: Optimizing images for static websites.
44
---
55

6-
If you are building a static site Nuxt Image will optimize and save your images locally when your site is generated - and deploy them alongside your generated pages. (This only works with server-side rendered pages. If you use `ssr: false`, won't work)
6+
If you are building a static site using `nuxt generate`, Nuxt Image will optimize and save your images locally when your site is generated - and deploy them alongside your generated pages.
77

8-
::alert{type="info"}
9-
Even if you are using another provider, you can opt-in to this generate behaviour for a particular image by setting `provider="static"` directly. (See [component documentation](/components/nuxt-img) for more information.)
8+
::alert{type="warning"}
9+
Static Image support is under progress for Nuxt 3.
1010
::

0 commit comments

Comments
 (0)