From dcfc3eccc25d0f803f92b16c0614605e6b4879ab Mon Sep 17 00:00:00 2001 From: Michal Vanko Date: Sat, 26 Sep 2020 14:49:58 +0200 Subject: [PATCH] Typescript support --- email-signature.html | 8 +- package-lock.json | 4096 ++++++++++++----- package.json | 46 +- rollup.config.js | 27 +- src/{client.js => client.ts} | 0 src/components/blog/article-footer.svelte | 5 +- src/components/portfolio/project.svelte | 6 +- .../{parse-markdown.js => parse-markdown.ts} | 4 +- .../blog/{[slug].json.js => [slug].json.ts} | 11 +- src/routes/blog/[slug].svelte | 4 +- src/routes/blog/{_content.js => _content.ts} | 42 +- .../blog/{index.json.js => index.json.ts} | 0 src/routes/blog/index.svelte | 9 +- src/routes/feed/{_feed.js => _feed.ts} | 8 +- .../feed/{index.json.js => index.json.ts} | 5 +- .../feed/{index.xml.js => index.xml.ts} | 5 +- .../{index.json.js => index.json.ts} | 26 +- src/server.js | 17 - src/server.ts | 17 + src/template.html | 9 +- tsconfig.json | 10 + typings/@sapper/index.d.ts | 41 + 22 files changed, 3132 insertions(+), 1264 deletions(-) rename src/{client.js => client.ts} (100%) rename src/markdown/{parse-markdown.js => parse-markdown.ts} (53%) rename src/routes/blog/{[slug].json.js => [slug].json.ts} (78%) rename src/routes/blog/{_content.js => _content.ts} (54%) rename src/routes/blog/{index.json.js => index.json.ts} (100%) rename src/routes/feed/{_feed.js => _feed.ts} (86%) rename src/routes/feed/{index.json.js => index.json.ts} (82%) rename src/routes/feed/{index.xml.js => index.xml.ts} (82%) rename src/routes/portfolio/{index.json.js => index.json.ts} (65%) delete mode 100644 src/server.js create mode 100644 src/server.ts create mode 100644 tsconfig.json create mode 100644 typings/@sapper/index.d.ts diff --git a/email-signature.html b/email-signature.html index 08c6dde..a2a5ebc 100644 --- a/email-signature.html +++ b/email-signature.html @@ -8,7 +8,7 @@ Michal Vanko - + Software Architect and Consultant - + - (warning.code === 'CIRCULAR_DEPENDENCY' && - /[/\\]@sapper[/\\]/.test(warning.message)) || + (warning.code === 'MISSING_EXPORT' && /'preload'/.test(warning.message)) || + (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning) const dedupe = (importee) => importee === 'svelte' || importee.startsWith('svelte/') export default { client: { - input: config.client.input(), + input: config.client.input().replace(/\.js$/, ".ts"), output: config.client.output(), plugins: [ replace({ @@ -33,9 +35,16 @@ export default { dev, hydratable: true, emitCss: true, + // Disabled automatic image compression // preprocess: { // ...image(), // }, + preprocess: sveltePreprocess({ + sourceMap: dev, + defaults: { + script: 'typescript', + }, + }), }), resolve({ browser: true, @@ -78,7 +87,7 @@ export default { }, server: { - input: config.server.input(), + input: config.server.input().server.replace(/\.js$/, ".ts"), output: config.server.output(), plugins: [ replace({ @@ -88,6 +97,13 @@ export default { svelte({ generate: 'ssr', dev, + hydratable: true, + preprocess: sveltePreprocess({ + sourceMap: dev, + defaults: { + script: 'typescript', + } + }), // preprocess: { // ...image(), // }, @@ -96,6 +112,7 @@ export default { dedupe, }), commonjs(), + typescript({ sourceMap: dev}), svg(), ], external: Object.keys(pkg.dependencies).concat( diff --git a/src/client.js b/src/client.ts similarity index 100% rename from src/client.js rename to src/client.ts diff --git a/src/components/blog/article-footer.svelte b/src/components/blog/article-footer.svelte index 4da81de..951f012 100644 --- a/src/components/blog/article-footer.svelte +++ b/src/components/blog/article-footer.svelte @@ -1,7 +1,8 @@ -