Skip to content

Commit 74cc5fe

Browse files
committed
fix
1 parent 21c9f26 commit 74cc5fe

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"postcss-load-config": "^3.1.4",
7777
"postcss-safe-parser": "^6.0.0",
7878
"postcss-selector-parser": "^6.0.11",
79+
"semver": "^7.5.3",
7980
"svelte-eslint-parser": "^0.31.0"
8081
},
8182
"devDependencies": {
@@ -110,6 +111,7 @@
110111
"@types/node": "^18.11.0",
111112
"@types/postcss-safe-parser": "^5.0.1",
112113
"@types/prismjs": "^1.26.0",
114+
"@types/semver": "^7.5.0",
113115
"@types/stylus": "^0.48.38",
114116
"@typescript-eslint/eslint-plugin": "^5.59.5",
115117
"@typescript-eslint/parser": "^5.59.5",
@@ -158,7 +160,6 @@
158160
"prismjs": "^1.25.0",
159161
"rimraf": "^5.0.0",
160162
"sass": "^1.51.0",
161-
"semver": "^7.3.5",
162163
"simple-git-hooks": "^2.8.0",
163164
"source-map-js": "^1.0.2",
164165
"stylelint": "^15.0.0",

src/shared/svelte-compile-warns/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { extractLeadingComments } from "./extract-leading-comments"
2121
import { getLangValue } from "../../utils/ast-utils"
2222
import path from "path"
2323
import fs from "fs"
24+
import semver from "semver"
2425

2526
type WarningTargetNode =
2627
| (AST.SvelteProgram & ASTNodeWithParent)
@@ -446,7 +447,9 @@ function getWarningsFromCode(code: string): {
446447
try {
447448
const result = compiler.compile(code, {
448449
generate: false,
449-
customElement: true,
450+
...(semver.satisfies(compiler.VERSION, ">=4.0.0-0")
451+
? { customElement: true }
452+
: {}),
450453
})
451454

452455
return { warnings: result.warnings as Warning[], kind: "warn" }

0 commit comments

Comments
 (0)