From 966425d75b67d48d89cbfa02affb344453222a6e Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Tue, 7 Dec 2021 15:10:58 +0900 Subject: [PATCH] fix site --- docs-svelte-kit/build-system/build.js | 6 +-- docs-svelte-kit/shim/path.mjs | 8 +++- .../src/lib/components/ESLintCodeBlock.svelte | 8 +++- .../lib/components/ESLintPlayground.svelte | 4 ++ .../src/lib/eslint/scripts/linter.js | 2 + src/index.ts | 2 +- src/processor/index.ts | 37 ++++++++++--------- 7 files changed, 42 insertions(+), 25 deletions(-) diff --git a/docs-svelte-kit/build-system/build.js b/docs-svelte-kit/build-system/build.js index 9cba5f0ea..10dde7403 100644 --- a/docs-svelte-kit/build-system/build.js +++ b/docs-svelte-kit/build-system/build.js @@ -17,8 +17,8 @@ build( /** build */ function build(input, out, injects = []) { console.log(`build@ ${input}`) - let code = bundle(input, injects) - code = transform(code, injects) + let code = bundle(input, ["path", ...injects]) + code = transform(code, ["path", ...injects]) fs.writeFileSync(out, code, "utf8") } @@ -28,7 +28,7 @@ function bundle(entryPoint, externals) { entryPoints: [entryPoint], format: "esm", bundle: true, - external: ["path", ...externals], + external: externals, write: false, }) diff --git a/docs-svelte-kit/shim/path.mjs b/docs-svelte-kit/shim/path.mjs index 6f5f54949..43b210d7d 100644 --- a/docs-svelte-kit/shim/path.mjs +++ b/docs-svelte-kit/shim/path.mjs @@ -4,7 +4,11 @@ function dirname(p) { return p.split("/").slice(0, -1).join("/") || p } -const posix = { dirname } +function extname(p) { + return /\.[\w$-]+$/iu.exec(p)[0] +} + +const posix = { dirname, extname } posix.posix = posix -export { dirname, posix } +export { dirname, extname, posix } export default posix diff --git a/docs-svelte-kit/src/lib/components/ESLintCodeBlock.svelte b/docs-svelte-kit/src/lib/components/ESLintCodeBlock.svelte index 3f6553a62..4024fac4f 100644 --- a/docs-svelte-kit/src/lib/components/ESLintCodeBlock.svelte +++ b/docs-svelte-kit/src/lib/components/ESLintCodeBlock.svelte @@ -1,7 +1,11 @@