From 1b193f6ebd4fb40bf5ea510eb0d6b52fe23b7087 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Thu, 7 Jul 2022 09:00:54 +0900 Subject: [PATCH] Chore: update svelte-kit --- package.json | 5 ++-- renovate.json | 3 +-- svelte.config.esm.mjs | 44 ----------------------------------- tsconfig.json | 2 +- vite.config.mjs | 53 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 58 insertions(+), 49 deletions(-) create mode 100644 vite.config.mjs diff --git a/package.json b/package.json index 39b3bdbbf..a59b7e6c9 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "prepublishOnly": "yarn clean && yarn build", "pretest:base": "cross-env DEBUG=eslint-plugin-svelte*", "preversion": "yarn test && git add .", - "svelte-kit": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js", + "svelte-kit": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/vite/bin/vite.js --config vite.config.mjs", "test": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000", "ts": "node -r esbuild-register", "update": "yarn ts ./tools/update.ts && yarn format-for-gen-file", @@ -77,7 +77,7 @@ "@ota-meshi/eslint-plugin": "^0.11.0", "@sindresorhus/slugify": "^2.1.0", "@sveltejs/adapter-static": "^1.0.0-next.26", - "@sveltejs/kit": "1.0.0-next.358", + "@sveltejs/kit": "^1.0.0-next.360", "@types/babel__core": "^7.1.19", "@types/eslint": "^8.0.0", "@types/eslint-scope": "^3.7.0", @@ -134,6 +134,7 @@ "svelte": "^3.46.1", "svelte-adapter-ghpages": "0.0.2", "typescript": "^4.5.2", + "vite": "^2.9.13", "vite-plugin-svelte-md": "^0.1.3" }, "publishConfig": { diff --git a/renovate.json b/renovate.json index 9f3c26cd4..252002909 100644 --- a/renovate.json +++ b/renovate.json @@ -13,6 +13,5 @@ "depTypeList": ["devDependencies"], "automerge": true } - ], - "ignoreDeps": ["@sveltejs/kit"] + ] } diff --git a/svelte.config.esm.mjs b/svelte.config.esm.mjs index 1ae4aa50d..0a27a6952 100644 --- a/svelte.config.esm.mjs +++ b/svelte.config.esm.mjs @@ -1,10 +1,6 @@ /* global __dirname, URL -- __dirname, URL */ import ghpagesAdapter from "svelte-adapter-ghpages" import path from "path" -import svelteMd from "vite-plugin-svelte-md" -import svelteMdOption from "./docs-svelte-kit/tools/vite-plugin-svelte-md-option.mjs" - -import "./docs-svelte-kit/build-system/build.js" const dirname = typeof __dirname !== "undefined" @@ -41,46 +37,6 @@ const config = { }, trailingSlash: "always", - - vite: { - server: { - fs: { strict: false }, - }, - resolve: { - alias: { - eslint: path.join(dirname, "./docs-svelte-kit/shim/eslint.mjs"), - assert: path.join(dirname, "./docs-svelte-kit/shim/assert.mjs"), - "postcss-load-config": path.join( - dirname, - "./docs-svelte-kit/shim/postcss-load-config.mjs", - ), - "source-map-js": path.join( - dirname, - "./docs-svelte-kit/shim/source-map-js.mjs", - ), - module: path.join(dirname, "./docs-svelte-kit/shim/module.mjs"), - path: path.join(dirname, "./docs-svelte-kit/shim/path.mjs"), - url: path.join(dirname, "./docs-svelte-kit/shim/url.mjs"), - os: path.join(dirname, "./docs-svelte-kit/shim/os.mjs"), - fs: path.join(dirname, "./docs-svelte-kit/shim/fs.mjs"), - globby: path.join(dirname, "./docs-svelte-kit/shim/globby.mjs"), - tslib: path.join(dirname, "./node_modules/tslib/tslib.es6.js"), - }, - }, - plugins: [ - svelteMd( - svelteMdOption({ - baseUrl: "/eslint-plugin-svelte", - root: path.join(dirname, "./docs"), - }), - ), - ], - build: { - commonjsOptions: { - ignoreDynamicRequires: true, - }, - }, - }, }, } export default config diff --git a/tsconfig.json b/tsconfig.json index e0a689f00..9c5f25268 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es2015", + "target": "es2020", "module": "commonjs", "lib": ["es2020", "dom"], "allowJs": true, diff --git a/vite.config.mjs b/vite.config.mjs new file mode 100644 index 000000000..a9c730e15 --- /dev/null +++ b/vite.config.mjs @@ -0,0 +1,53 @@ +/* global URL -- URL */ +import { sveltekit } from "@sveltejs/kit/vite" +import path from "path" +import svelteMd from "vite-plugin-svelte-md" +import svelteMdOption from "./docs-svelte-kit/tools/vite-plugin-svelte-md-option.mjs" + +import "./docs-svelte-kit/build-system/build.js" + +const dirname = path.dirname(new URL(import.meta.url).pathname) + +/** @type {import('vite').UserConfig} */ +const config = { + plugins: [ + svelteMd( + svelteMdOption({ + baseUrl: "/eslint-plugin-svelte", + root: path.join(dirname, "./docs"), + }), + ), + sveltekit(), + ], + server: { + fs: { strict: false }, + }, + resolve: { + alias: { + eslint: path.join(dirname, "./docs-svelte-kit/shim/eslint.mjs"), + assert: path.join(dirname, "./docs-svelte-kit/shim/assert.mjs"), + "postcss-load-config": path.join( + dirname, + "./docs-svelte-kit/shim/postcss-load-config.mjs", + ), + "source-map-js": path.join( + dirname, + "./docs-svelte-kit/shim/source-map-js.mjs", + ), + module: path.join(dirname, "./docs-svelte-kit/shim/module.mjs"), + path: path.join(dirname, "./docs-svelte-kit/shim/path.mjs"), + url: path.join(dirname, "./docs-svelte-kit/shim/url.mjs"), + os: path.join(dirname, "./docs-svelte-kit/shim/os.mjs"), + fs: path.join(dirname, "./docs-svelte-kit/shim/fs.mjs"), + globby: path.join(dirname, "./docs-svelte-kit/shim/globby.mjs"), + tslib: path.join(dirname, "./node_modules/tslib/tslib.es6.js"), + }, + }, + build: { + commonjsOptions: { + ignoreDynamicRequires: true, + }, + }, +} + +export default config