Skip to content

Version 4.0.0 #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
29 changes: 8 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,20 @@ jobs:

strategy:
matrix:
node_version: [14, 16, 18, 20]
node_version: [18, 20, 22]
os: [ubuntu-latest, windows-latest, macos-latest]
include:
# Active LTS + other OS
- os: macos-latest
node_version: 18
node_version: 22
- os: windows-latest
node_version: 18
node_version: 22
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Install pnpm (node 14, pnpm 7)
if: matrix.node_version == 14
uses: pnpm/action-setup@v3
with:
version: 7

- name: Install pnpm (node 16, pnpm 8)
if: matrix.node_version == 16
uses: pnpm/action-setup@v3
with:
version: 8

- name: Install pnpm
if: matrix.node_version > 16
uses: pnpm/action-setup@v3

- name: Use Node.js ${{ matrix.node-version }}
Expand Down Expand Up @@ -70,10 +57,10 @@ jobs:

- uses: pnpm/action-setup@v4

- name: Set node version to 20
- name: Set node version to 22
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: pnpm

- name: Install
Expand All @@ -92,7 +79,7 @@ jobs:

lint:
runs-on: ubuntu-latest
name: 'Lint: node-20, ubuntu-latest'
name: 'Lint: node-22, ubuntu-latest'

steps:
- uses: actions/checkout@v4
Expand All @@ -101,10 +88,10 @@ jobs:

- uses: pnpm/action-setup@v4

- name: Set node version to 20
- name: Set node version to 22
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: pnpm

- name: Install
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@applelo/unplugin-inject-preload",
"version": "3.0.0",
"version": "4.0.0",
"exports": {
".": "./src/index.ts",
"./vite": "./src/vite.ts",
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "unplugin-inject-preload",
"type": "module",
"version": "3.0.0",
"packageManager": "pnpm@9.9.0",
"version": "4.0.0",
"packageManager": "pnpm@9.15.0",
"description": "Inject <link rel='preload'> for Webpack/ViteJS",
"license": "MIT",
"homepage": "https://github.com/applelo/unplugin-inject-preload#readme",
Expand Down Expand Up @@ -67,7 +67,7 @@
"dist"
],
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": "^18.0.0 || >=20.0.0"
},
"scripts": {
"build": "tsup",
Expand All @@ -89,28 +89,28 @@
},
"dependencies": {
"mime-types": "^2.1.35",
"unplugin": "^1.12.2",
"unplugin": "^2.1.0",
"webpack-sources": "^3.2.3"
},
"devDependencies": {
"@antfu/eslint-config": "3.0.0",
"@rspack/core": "^1.0.0",
"@antfu/eslint-config": "3.12.0",
"@rspack/core": "^1.1.6",
"@types/mime-types": "^2.1.4",
"@types/node": "^22.5.1",
"@types/node": "^22.10.2",
"@types/webpack-sources": "^3.2.3",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/coverage-v8": "^2.1.8",
"css-loader": "^7.1.2",
"esno": "^4.7.0",
"esno": "^4.8.0",
"fast-glob": "^3.3.2",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.9.1",
"prettier": "^3.3.3",
"html-webpack-plugin": "^5.6.3",
"mini-css-extract-plugin": "^2.9.2",
"prettier": "^3.4.2",
"ts-loader": "^9.5.1",
"tsup": "^8.2.4",
"tsx": "^4.19.0",
"typescript": "^5.5.4",
"vite": "^5.4.2",
"vitest": "^2.0.5",
"webpack": "^5.94.0"
"tsup": "^8.3.5",
"tsx": "^4.19.2",
"typescript": "^5.7.2",
"vite": "^6.0.3",
"vitest": "^2.1.8",
"webpack": "^5.97.1"
}
}
2 changes: 1 addition & 1 deletion playground/rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"build": "rspack build"
},
"devDependencies": {
"@rspack/cli": "1.0.0",
"@rspack/cli": "1.1.6",
"unplugin-inject-preload": "workspace:*"
}
}
12 changes: 11 additions & 1 deletion playground/vitejs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@
</head>
<body>
<h1>Unplugin Inject Preload</h1>
<a href="page.html">Go to the page (test multi page generation)</a>
<ul>
<li>
<a href="page.html">Go to the page (test multi page generation)</a>
</li>
<li>
<a href="nested">Go to the page (test nested page generation)</a>
</li>
<li>
<a href="nested/sub-nested">Go to the page (test nested subfolder page generation)</a>
</li>
</ul>
<script type="module" src="./main.ts"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions playground/vitejs/nested/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Unplugin Inject Preload</title>
<!--__unplugin-inject-preload__-->
</head>
<body>
<h1>Unplugin Inject Preload - Nested Page</h1>
<a href="/">Return to the main page</a>
<script type="module" src="../main.ts"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions playground/vitejs/nested/sub-nested/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Unplugin Inject Preload</title>
<!--__unplugin-inject-preload__-->
</head>
<body>
<h1>Unplugin Inject Preload - Nested Subfolder Page</h1>
<a href="/">Return to the main page</a>
<script type="module" src="../../main.ts"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions playground/vitejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"preview": "vite preview"
},
"devDependencies": {
"typescript": "^5.5.4",
"typescript": "^5.7.2",
"unplugin-inject-preload": "workspace:*",
"vite": "^5.4.2",
"vite-plugin-inspect": "^0.8.7"
"vite": "^6.0.3",
"vite-plugin-inspect": "^0.10.3"
}
}
6 changes: 4 additions & 2 deletions playground/vitejs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { resolve } from 'node:path'
import { defineConfig } from 'vite'

// import Inspect from 'vite-plugin-inspect'
import UnpluginInjectPreload from 'unplugin-inject-preload/vite'

import { defineConfig } from 'vite'

export default defineConfig({
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
page: resolve(__dirname, 'page.html'),
nested: resolve(__dirname, 'nested/index.html'),
subNested: resolve(__dirname, 'nested/sub-nested/index.html'),
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions playground/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
},
"devDependencies": {
"css-loader": "^7.1.2",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.9.1",
"html-webpack-plugin": "^5.6.3",
"mini-css-extract-plugin": "^2.9.2",
"ts-loader": "^9.5.1",
"typescript": "^5.5.4",
"typescript": "^5.7.2",
"unplugin-inject-preload": "workspace:*",
"webpack": "^5.94.0",
"webpack": "^5.97.1",
"webpack-cli": "^5.1.4"
}
}
2 changes: 1 addition & 1 deletion playground/webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('node:path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const UnpluginInjectPreload = require('unplugin-inject-preload/webpack')

module.exports = {
Expand Down
Loading
Loading