Skip to content

Commit 9683bf5

Browse files
committed
fix: support node 18
fixes #325
1 parent c396176 commit 9683bf5

File tree

9 files changed

+65
-31
lines changed

9 files changed

+65
-31
lines changed

packages/shared/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
},
2626
"homepage": "https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/shared",
2727
"dependencies": {
28-
"find-cache-dir": "^5.0.0",
2928
"upath": "^2.0.1"
3029
},
3130
"peerDependencies": {

packages/shared/src/imports/getImports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { parseTemplate, TemplateMatch } from './parseTemplate'
2-
import * as importMap from 'vuetify/dist/json/importMap.json' with { type: 'json' }
3-
import * as importMapLabs from 'vuetify/dist/json/importMap-labs.json' with { type: 'json' }
2+
import importMap from 'vuetify/dist/json/importMap.json' assert { type: 'json' }
3+
import importMapLabs from 'vuetify/dist/json/importMap-labs.json' assert { type: 'json' }
44
import { isObject } from '../'
55
import type { Options } from '../'
66

packages/shared/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import * as path from 'upath'
1+
import { createRequire } from 'node:module'
2+
import path from 'upath'
23
import type * as Components from 'vuetify/components'
34
import type * as Directives from 'vuetify/directives'
45

6+
const require = createRequire(import.meta.url)
7+
58
export interface Options {
69
autoImport?: ImportPluginOptions,
710
styles?: true | 'none' | 'sass' | {
@@ -18,7 +21,6 @@ export type ImportPluginOptions =
1821
| ObjectImportPluginOptions
1922

2023
export { generateImports } from './imports/generateImports'
21-
export { cacheDir, writeStyles } from './styles/writeStyles'
2224

2325
export function resolveVuetifyBase () {
2426
return path.dirname(require.resolve('vuetify/package.json', { paths: [process.cwd()] }))

packages/shared/src/styles/writeStyles.ts

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

packages/vite-plugin/src/stylesPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as path from 'upath'
1+
import path from 'upath'
22
import { resolveVuetifyBase, normalizePath, isObject } from '@vuetify/loader-shared'
33

44
import type { Plugin } from 'vite'

packages/webpack-plugin/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@vuetify/loader-shared": "^2.0.0",
3030
"decache": "^4.6.0",
3131
"file-loader": "^6.2.0",
32+
"find-cache-dir": "^5.0.0",
3233
"loader-utils": "^2.0.0",
3334
"mkdirp": "^1.0.4",
3435
"null-loader": "^4.0.1",

packages/webpack-plugin/src/plugin.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { createRequire } from 'node:module'
12
import { URLSearchParams } from 'url'
23
import { writeFile } from 'fs/promises'
34

@@ -7,7 +8,6 @@ import mkdirp from 'mkdirp'
78
import {
89
resolveVuetifyBase,
910
isObject,
10-
cacheDir,
1111
transformAssetUrls,
1212
normalizePath,
1313
} from '@vuetify/loader-shared'
@@ -33,8 +33,9 @@ export class VuetifyPlugin {
3333
}
3434
}
3535

36-
apply (compiler: Compiler) {
36+
async apply (compiler: Compiler) {
3737
if (this.options.autoImport) {
38+
const require = createRequire(import.meta.url)
3839
compiler.options.module.rules.unshift({
3940
resourceQuery: query => {
4041
if (!query) return false
@@ -88,6 +89,11 @@ export class VuetifyPlugin {
8889
} else if (this.options.styles === 'sass') {
8990
hookResolve(file => file.replace(/\.css$/, '.sass'))
9091
} else if (isObject(this.options.styles)) {
92+
const findCacheDir = (await import('find-cache-dir')).default
93+
const cacheDir = findCacheDir({
94+
name: 'vuetify',
95+
create: true,
96+
})!
9197
const configFile = path.isAbsolute(this.options.styles.configFile)
9298
? this.options.styles.configFile
9399
: path.join(

scripts/patchMJS.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if (matchJson.length) {
99
for (let i = matchJson.length - 1; i >= 0; i--) {
1010
const match = matchJson[i]
1111
code = code.slice(0, match.index + match[1].length) +
12-
' with { type: \'json\' }' +
12+
' assert { type: \'json\' }' +
1313
code.slice(match.index + match[1].length)
1414
}
1515

yarn.lock

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2636,6 +2636,14 @@
26362636
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.3.11.tgz#f6a038e15237edefcc90dbfe7edb806dd355c7bd"
26372637
integrity sha512-u2G8ZQ9IhMWTMXaWqZycnK4UthG1fA238CD+DP4Dm4WJi5hdUKKLg0RMRaRpDPNMdkTwIDkp7WtD0Rd9BH9fLw==
26382638

2639+
"@vuetify/loader-shared@^1.7.1":
2640+
version "1.7.1"
2641+
resolved "https://registry.yarnpkg.com/@vuetify/loader-shared/-/loader-shared-1.7.1.tgz#0f63a3d41b6df29a2db1ff438aa1819b237c37a3"
2642+
integrity sha512-kLUvuAed6RCvkeeTNJzuy14pqnkur8lTuner7v7pNE/kVhPR97TuyXwBSBMR1cJeiLiOfu6SF5XlCYbXByEx1g==
2643+
dependencies:
2644+
find-cache-dir "^3.3.2"
2645+
upath "^2.0.1"
2646+
26392647
"@webassemblyjs/[email protected]", "@webassemblyjs/ast@^1.11.5":
26402648
version "1.11.6"
26412649
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.6.tgz#db046555d3c413f8966ca50a95176a0e2c642e24"
@@ -5071,6 +5079,15 @@ [email protected]:
50715079
statuses "2.0.1"
50725080
unpipe "~1.0.0"
50735081

5082+
find-cache-dir@^3.3.2:
5083+
version "3.3.2"
5084+
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.2.tgz#b30c5b6eff0730731aea9bbd9dbecbd80256d64b"
5085+
integrity sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==
5086+
dependencies:
5087+
commondir "^1.0.1"
5088+
make-dir "^3.0.2"
5089+
pkg-dir "^4.1.0"
5090+
50745091
find-cache-dir@^4.0.0:
50755092
version "4.0.0"
50765093
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-4.0.0.tgz#a30ee0448f81a3990708f6453633c733e2f6eec2"
@@ -6782,6 +6799,13 @@ make-dir@^2.1.0:
67826799
pify "^4.0.1"
67836800
semver "^5.6.0"
67846801

6802+
make-dir@^3.0.2:
6803+
version "3.1.0"
6804+
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
6805+
integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==
6806+
dependencies:
6807+
semver "^6.0.0"
6808+
67856809
make-fetch-happen@^5.0.0:
67866810
version "5.0.2"
67876811
resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-5.0.2.tgz#aa8387104f2687edca01c8687ee45013d02d19bd"
@@ -7912,7 +7936,7 @@ pkg-dir@^3.0.0:
79127936
dependencies:
79137937
find-up "^3.0.0"
79147938

7915-
pkg-dir@^4.2.0:
7939+
pkg-dir@^4.1.0, pkg-dir@^4.2.0:
79167940
version "4.2.0"
79177941
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
79187942
integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==
@@ -10198,6 +10222,15 @@ vite-plugin-inspect@^0.8.1:
1019810222
picocolors "^1.0.0"
1019910223
sirv "^2.0.3"
1020010224

10225+
vite-plugin-vuetify@^1.0.2:
10226+
version "1.0.2"
10227+
resolved "https://registry.yarnpkg.com/vite-plugin-vuetify/-/vite-plugin-vuetify-1.0.2.tgz#d1777c63aa1b3a308756461b3d0299fd101ee8f4"
10228+
integrity sha512-MubIcKD33O8wtgQXlbEXE7ccTEpHZ8nPpe77y9Wy3my2MWw/PgehP9VqTp92BLqr0R1dSL970Lynvisx3UxBFw==
10229+
dependencies:
10230+
"@vuetify/loader-shared" "^1.7.1"
10231+
debug "^4.3.3"
10232+
upath "^2.0.1"
10233+
1020110234
vite@^5.0.6:
1020210235
version "5.0.6"
1020310236
resolved "https://registry.yarnpkg.com/vite/-/vite-5.0.6.tgz#f9e13503a4c5ccd67312c67803dec921f3bdea7c"
@@ -10348,6 +10381,20 @@ webpack-merge@^5.7.3:
1034810381
clone-deep "^4.0.1"
1034910382
wildcard "^2.0.0"
1035010383

10384+
webpack-plugin-vuetify@^2.0.1:
10385+
version "2.0.1"
10386+
resolved "https://registry.yarnpkg.com/webpack-plugin-vuetify/-/webpack-plugin-vuetify-2.0.1.tgz#735da7458a93670431399115bcb1f6cc72cb65b3"
10387+
integrity sha512-vopDoL1Il9lhDReAYdhToMi/OkFqV8BebEEyviZqMwFvQ3XnsRIdPyDDvee336h46QzCg3utp/FL5h2DhqeqAw==
10388+
dependencies:
10389+
"@vuetify/loader-shared" "^1.7.1"
10390+
decache "^4.6.0"
10391+
file-loader "^6.2.0"
10392+
find-cache-dir "^3.3.2"
10393+
loader-utils "^2.0.0"
10394+
mkdirp "^1.0.4"
10395+
null-loader "^4.0.1"
10396+
upath "^2.0.1"
10397+
1035110398
webpack-sources@^3.2.3:
1035210399
version "3.2.3"
1035310400
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde"

0 commit comments

Comments
 (0)