Skip to content

Commit

Permalink
Merge pull request #19 from Applelo/dev
Browse files Browse the repository at this point in the history
Version 3.0.0
  • Loading branch information
Applelo authored Aug 30, 2024
2 parents 6a797c7 + 4e8bebd commit 2458c27
Show file tree
Hide file tree
Showing 13 changed files with 1,232 additions and 1,430 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This plugin adds preload links by getting output assets from the build tools you
Supporting:
- Vite 4 and 5 **(on build only)**
- Webpack 5 (with [HtmlWebpackPlugin 5](https://github.com/jantimon/html-webpack-plugin))
- Rspack (with [HtmlWebpackPlugin 5](https://github.com/jantimon/html-webpack-plugin) or [HtmlRspackPlugin](https://www.rspack.dev/config/plugins.html#htmlrspackplugin))
- Rspack 1.0 (with [HtmlWebpackPlugin 5](https://github.com/jantimon/html-webpack-plugin) or [HtmlRspackPlugin](https://www.rspack.dev/config/plugins.html#htmlrspackplugin))

> [!NOTE]
> This plugin combines [vite-plugin-inject-preload](https://github.com/Applelo/vite-plugin-inject-preload) and [html-webpack-inject-preload](https://github.com/principalstudio/html-webpack-inject-preload) into one package.
Expand Down Expand Up @@ -205,7 +205,7 @@ export default {
{
"devDependencies": {
- "vite-plugin-inject-preload": "*",
+ "unplugin-inject-preload": "^2.0.0",
+ "unplugin-inject-preload": "^3.0.0",
}
}
```
Expand All @@ -218,7 +218,8 @@ export default {

export default {
plugins: [
VitePluginInjectPreload({
- VitePluginInjectPreload({
+ UnpluginInjectPreload({
files: [
{
- match: /Roboto-[a-zA-Z]*-[a-z-0-9]*\.woff2$/,
Expand All @@ -245,7 +246,7 @@ export default {
{
"devDependencies": {
- "@principalstudio/html-webpack-inject-preload": "*",
+ "unplugin-inject-preload": "^2.0.0",
+ "unplugin-inject-preload": "^3.0.0",
}
}
```
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": "2.0.5",
"version": "3.0.0",
"exports": {
".": "./src/index.ts",
"./vite": "./src/vite.ts",
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "unplugin-inject-preload",
"type": "module",
"version": "2.0.5",
"packageManager": "pnpm@9.5.0",
"version": "3.0.0",
"packageManager": "pnpm@9.9.0",
"description": "Inject <link rel='preload'> for Webpack/ViteJS",
"license": "MIT",
"homepage": "https://github.com/applelo/unplugin-inject-preload#readme",
Expand Down Expand Up @@ -89,28 +89,28 @@
},
"dependencies": {
"mime-types": "^2.1.35",
"unplugin": "^1.11.0",
"unplugin": "^1.12.2",
"webpack-sources": "^3.2.3"
},
"devDependencies": {
"@antfu/eslint-config": "2.23.0",
"@rspack/core": "^0.7.5",
"@antfu/eslint-config": "3.0.0",
"@rspack/core": "^1.0.0",
"@types/mime-types": "^2.1.4",
"@types/node": "^20.14.11",
"@types/node": "^22.5.1",
"@types/webpack-sources": "^3.2.3",
"@vitest/coverage-v8": "^2.0.3",
"@vitest/coverage-v8": "^2.0.5",
"css-loader": "^7.1.2",
"esno": "^4.7.0",
"fast-glob": "^3.3.2",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.9.0",
"mini-css-extract-plugin": "^2.9.1",
"prettier": "^3.3.3",
"ts-loader": "^9.5.1",
"tsup": "^8.2.0",
"tsx": "^4.16.2",
"typescript": "^5.5.3",
"vite": "^5.3.4",
"vitest": "^2.0.3",
"webpack": "^5.93.0"
"tsup": "^8.2.4",
"tsx": "^4.19.0",
"typescript": "^5.5.4",
"vite": "^5.4.2",
"vitest": "^2.0.5",
"webpack": "^5.94.0"
}
}
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": "0.7.5",
"@rspack/cli": "1.0.0",
"unplugin-inject-preload": "workspace:*"
}
}
28 changes: 25 additions & 3 deletions playground/rspack/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
const path = require('node:path')
const rspack = require('@rspack/core')
const UnpluginInjectPreload = require('unplugin-inject-preload/rspack').default
const UnpluginInjectPreload = require('unplugin-inject-preload/rspack')
// const HtmlWebpackPlugin = require('html-webpack-plugin')

/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
entry: './../src/main.ts',
output: {
publicPath: 'dist',
publicPath: path.join(__dirname, 'dist'),
filename: 'main.js',
path: 'dist',
path: path.join(__dirname, 'dist'),
clean: true,
assetModuleFilename: '[name].[hash][ext][query]',
},
experiments: {
css: true,
},
module: {
rules: [
{
Expand All @@ -23,8 +27,26 @@ const config = {
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource',
},
{
test: /\.ts$/,
loader: 'builtin:swc-loader',
options: {
jsc: {
parser: {
syntax: 'typescript',
},
},
},
type: 'javascript/auto',
},
],
},
resolve: {
extensions: ['.ts', '.js'],
extensionAlias: {
'.js': ['.js', '.ts'],
},
},
plugins: [
new rspack.HtmlRspackPlugin({
minify: false,
Expand Down
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.3",
"typescript": "^5.5.4",
"unplugin-inject-preload": "workspace:*",
"vite": "^5.3.4",
"vite-plugin-inspect": "^0.8.5"
"vite": "^5.4.2",
"vite-plugin-inspect": "^0.8.7"
}
}
6 changes: 3 additions & 3 deletions playground/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"devDependencies": {
"css-loader": "^7.1.2",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.9.0",
"mini-css-extract-plugin": "^2.9.1",
"ts-loader": "^9.5.1",
"typescript": "^5.5.3",
"typescript": "^5.5.4",
"unplugin-inject-preload": "workspace:*",
"webpack": "^5.93.0",
"webpack": "^5.94.0",
"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,7 +1,7 @@
const path = require('node:path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const UnpluginInjectPreload = require('unplugin-inject-preload/webpack').default
const UnpluginInjectPreload = require('unplugin-inject-preload/webpack')

module.exports = {
entry: path.resolve(__dirname, './../src/main.ts'),
Expand Down
Loading

0 comments on commit 2458c27

Please sign in to comment.