Skip to content

Commit 34a03c1

Browse files
committed
feat: add esm build
closes #319 BREAKING CHANGE: Requires node >18
1 parent c43dc80 commit 34a03c1

File tree

14 files changed

+3138
-1959
lines changed

14 files changed

+3138
-1959
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ module.exports = {
1111
'plugin:import/typescript',
1212
],
1313
rules: {
14-
'import/no-extraneous-dependencies': ['error', { devDependencies: false }]
14+
'import/no-extraneous-dependencies': ['error', { devDependencies: false }],
1515
}
1616
}

dev/.eslintrc.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
rules: {
3+
'import/no-extraneous-dependencies': 'off',
4+
},
5+
}

dev/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
"debug:webpack-build": "NODE_ENV=production node --inspect-brk ../node_modules/.bin/webpack --config webpack.config.js"
1414
},
1515
"devDependencies": {
16-
"@babel/core": "^7.16.0",
17-
"@babel/preset-env": "^7.16.4",
18-
"babel-loader": "^8.2.3",
19-
"css-loader": "^6.5.1",
16+
"@babel/core": "^7.23.5",
17+
"@babel/preset-env": "^7.23.5",
18+
"babel-loader": "^9.1.3",
19+
"css-loader": "^6.8.1",
2020
"pug": "^3.0.2",
2121
"pug-plain-loader": "^1.1.0",
22-
"rollup-plugin-visualizer": "^5.8.3",
23-
"sass-loader": "^12.6.0",
22+
"rollup-plugin-visualizer": "^5.10.0",
23+
"sass-loader": "^13.3.2",
2424
"url-loader": "^4.1.1",
25-
"vite-plugin-inspect": "^0.4.3",
26-
"vite-plugin-vuetify": "^1.0.0-alpha.1",
25+
"vite-plugin-inspect": "^0.8.1",
26+
"vite-plugin-vuetify": "^1.0.2",
2727
"vue-style-loader": "^4.1.3",
28-
"webpack-cli": "^4.9.1",
29-
"webpack-dev-server": "^4.6.0",
30-
"webpack-plugin-vuetify": "^2.0.0-alpha.1"
28+
"webpack-cli": "^5.1.4",
29+
"webpack-dev-server": "^4.15.1",
30+
"webpack-plugin-vuetify": "^2.0.1"
3131
}
3232
}
File renamed without changes.

package.json

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,34 @@
55
"packages/*"
66
],
77
"scripts": {
8-
"lint": "eslint packages/*/src/**/*",
9-
"dev": "lerna run dev --parallel -- --preserveWatchOutput",
8+
"lint": "eslint packages/*/src/**/* && tsc --noEmit",
9+
"dev": "lerna run dev",
10+
"dev:vite": "lerna run dev:vite --stream --no-prefix",
11+
"dev:webpack": "lerna run dev:webpack --stream --no-prefix",
1012
"build": "lerna run build",
1113
"publish": "lerna run build && lerna version --no-private && lerna publish from-git"
1214
},
1315
"devDependencies": {
1416
"@types/debug": "^4.1.7",
15-
"@types/find-cache-dir": "^3.2.1",
16-
"@types/loader-utils": "^2.0.3",
17-
"@types/node": "^16.11.12",
17+
"@types/loader-utils": "^2.0.6",
1818
"@types/mkdirp": "^1.0.2",
19-
"@typescript-eslint/eslint-plugin": "^5.29.0",
20-
"@typescript-eslint/parser": "^5.29.0",
21-
"@vitejs/plugin-vue": "^4.0.0",
22-
"@vue/compiler-sfc": "^3.2.45",
19+
"@types/node": "^20.10.4",
20+
"@typescript-eslint/eslint-plugin": "^6.13.2",
21+
"@typescript-eslint/parser": "^6.13.2",
22+
"@vitejs/plugin-vue": "^4.5.2",
23+
"@vue/compiler-sfc": "^3.3.11",
2324
"conventional-changelog-conventionalcommits": "^4.6.1",
2425
"eslint": "^8.18.0",
2526
"eslint-plugin-import": "^2.26.0",
2627
"lerna": "^3.22.1",
27-
"sass": "^1.52.3",
28-
"typescript": "^4.4.2",
29-
"vite": "^4.0.0",
30-
"vue": "^3.2.45",
28+
"picocolors": "^1.0.0",
29+
"sass": "^1.69.5",
30+
"typescript": "^5.3.3",
31+
"unbuild": "^2.0.0",
32+
"vite": "^5.0.6",
33+
"vue": "^3.3.11",
3134
"vue-loader": "^16.5.0",
32-
"vuetify": "^3.0.4",
33-
"webpack": "^5.65.0"
35+
"vuetify": "^3.4.6",
36+
"webpack": "^5.89.0"
3437
}
3538
}

packages/shared/package.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
{
22
"name": "@vuetify/loader-shared",
33
"version": "1.7.1",
4-
"main": "dist/index.js",
5-
"types": "dist/index.d.ts",
4+
"main": "./dist/index.cjs",
5+
"module": "./dist/index.mjs",
6+
"types": "./dist/index.d.ts",
7+
"exports": {
8+
".": {
9+
"import": "./dist/index.mjs",
10+
"require": "./dist/index.cjs"
11+
}
12+
},
613
"repository": {
714
"type": "git",
815
"url": "git+https://github.com/vuetifyjs/vuetify-loader.git"
916
},
1017
"scripts": {
11-
"build": "tsc --outdir dist",
12-
"dev": "yarn run build --watch"
18+
"build": "unbuild",
19+
"dev": "unbuild --stub"
1320
},
1421
"author": "Kael Watts-Deuchar",
1522
"license": "MIT",
@@ -18,20 +25,16 @@
1825
},
1926
"homepage": "https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/shared",
2027
"dependencies": {
21-
"find-cache-dir": "^3.3.2",
28+
"find-cache-dir": "^5.0.0",
2229
"upath": "^2.0.1"
2330
},
2431
"peerDependencies": {
2532
"vue": "^3.0.0",
26-
"vuetify": "^3.0.0-beta.4"
33+
"vuetify": "^3.0.0"
2734
},
2835
"files": [
2936
"dist/"
3037
],
31-
"exports": {
32-
".": "./dist/index.js",
33-
"./*": "./*"
34-
},
3538
"publishConfig": {
3639
"access": "public"
3740
}

packages/shared/src/styles/writeStyles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
import path from 'upath'
12
import { writeFile } from 'fs/promises'
2-
import * as findCacheDir from 'find-cache-dir'
3+
import findCacheDir from 'find-cache-dir'
34
import { normalizePath } from '../index'
45

56
export const cacheDir = findCacheDir({
67
name: 'vuetify',
78
create: true,
8-
thunk: true
99
})!
1010

1111
export function writeStyles (files: Set<string>) {
1212
return writeFile(
13-
cacheDir('styles.scss'),
13+
path.join(cacheDir, 'styles.scss'),
1414
[
1515
'vuetify/lib/styles/main.sass',
1616
'vuetify/dist/_component-variables.sass',

packages/vite-plugin/package.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@
22
"name": "vite-plugin-vuetify",
33
"version": "1.0.2",
44
"description": "A Vite plugin for treeshaking Vuetify components and more",
5-
"main": "dist/index.js",
6-
"types": "dist/index.d.ts",
5+
"main": "./dist/index.cjs",
6+
"module": "./dist/index.mjs",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"import": "./dist/index.mjs",
11+
"require": "./dist/index.cjs"
12+
}
13+
},
714
"repository": {
815
"type": "git",
916
"url": "git+https://github.com/vuetifyjs/vuetify-loader.git"
1017
},
1118
"scripts": {
12-
"build": "tsc --outdir dist",
13-
"dev": "yarn run build --watch"
19+
"build": "unbuild && node ../../scripts/patchCJS.mjs",
20+
"dev": "unbuild --stub"
1421
},
1522
"author": "Kael Watts-Deuchar",
1623
"license": "MIT",
@@ -24,12 +31,12 @@
2431
"upath": "^2.0.1"
2532
},
2633
"peerDependencies": {
27-
"vite": "^2.7.0 || ^3.0.0 || ^4.0.0",
34+
"vite": ">=5",
2835
"vue": "^3.0.0",
29-
"vuetify": "^3.0.0-beta.4"
36+
"vuetify": "^3.0.0"
3037
},
3138
"engines": {
32-
"node": ">=12"
39+
"node": "^18.0.0 || >=20.0.0"
3340
},
3441
"files": [
3542
"dist/"

packages/vite-plugin/src/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Options, isObject, includes, transformAssetUrls } from '@vuetify/loader
44
import { importPlugin } from './importPlugin'
55
import { stylesPlugin } from './stylesPlugin'
66

7-
function vuetify (_options: Options = {}): Plugin[] {
7+
export default function vuetify (_options: Options = {}): Plugin[] {
88
const options: Options = {
99
autoImport: true,
1010
styles: true,
@@ -21,9 +21,6 @@ function vuetify (_options: Options = {}): Plugin[] {
2121

2222
return plugins
2323
}
24+
vuetify.transformAssetUrls = transformAssetUrls
2425

25-
module.exports = vuetify
26-
export default vuetify
27-
28-
module.exports.transformAssetUrls = transformAssetUrls
29-
export { transformAssetUrls }
26+
export { transformAssetUrls } from '@vuetify/loader-shared'

packages/webpack-plugin/package.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@
22
"name": "webpack-plugin-vuetify",
33
"version": "2.0.1",
44
"description": "A Webpack plugin for treeshaking Vuetify components and more",
5-
"main": "dist/index.js",
6-
"types": "dist/index.d.ts",
5+
"main": "./dist/index.cjs",
6+
"module": "./dist/index.mjs",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"import": "./dist/index.mjs",
11+
"require": "./dist/index.cjs"
12+
}
13+
},
714
"repository": {
815
"type": "git",
916
"url": "git+https://github.com/vuetifyjs/vuetify-loader.git"
1017
},
1118
"scripts": {
12-
"build": "tsc --outdir dist",
13-
"dev": "yarn run build --watch"
19+
"build": "unbuild",
20+
"dev": "unbuild --stub"
1421
},
1522
"author": "Kael Watts-Deuchar",
1623
"license": "MIT",
@@ -22,7 +29,6 @@
2229
"@vuetify/loader-shared": "^1.7.1",
2330
"decache": "^4.6.0",
2431
"file-loader": "^6.2.0",
25-
"find-cache-dir": "^3.3.2",
2632
"loader-utils": "^2.0.0",
2733
"mkdirp": "^1.0.4",
2834
"null-loader": "^4.0.1",
@@ -31,7 +37,7 @@
3137
"peerDependencies": {
3238
"@vue/compiler-sfc": "^3.2.6",
3339
"vue": "^3.2.6",
34-
"vuetify": "^3.0.0-beta.4",
40+
"vuetify": "^3.0.0",
3541
"webpack": "^5.0.0"
3642
},
3743
"optionalPeerDependencies": {
@@ -40,7 +46,7 @@
4046
"sharp": "^0.21.0"
4147
},
4248
"engines": {
43-
"node": ">=12"
49+
"node": "^18.0.0 || >=20.0.0"
4450
},
4551
"files": [
4652
"dist/"

0 commit comments

Comments
 (0)