Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sveltejs/kit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: @sveltejs/kit@1.0.0-next.417
Choose a base ref
...
head repository: sveltejs/kit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: @sveltejs/kit@1.0.0-next.418
Choose a head ref
  • 6 commits
  • 273 files changed
  • 6 contributors

Commits on Aug 17, 2022

  1. chore: give verbose names to form args "e" (#5983)

    * chore: give verbose names to form args "e"
    
    * Create chilled-years-smash.md
    
    Co-authored-by: Rich Harris <hello@rich-harris.dev>
    josefaidt and Rich-Harris authored Aug 17, 2022
    Copy the full SHA
    7b4803a View commit details
  2. [fix] Fix params and parent data types (#5974)

    * Fix params and parent data types
    
    * add output generic to load function types, helps with #5963
    
    * remove JSONObject, add event types to $types
    
    * fix types
    
    * changeset
    dummdidumm authored Aug 17, 2022
    Copy the full SHA
    ad0ffa2 View commit details
  3. [breaking] move packaging functionality into its own package (#5730)

    * [breaking] move package command into separate package
    
    * enhance create-svelte with libskeleton option
    
    * remove package from kit
    
    * update docs
    
    * move shared code into internal package
    
    * update workflow to build shared first
    
    * please?
    
    * remove cyclic dependency
    
    * fixes
    
    * fix
    
    * @internal/shared is a no-go since we no longer bundle, unless we publish it to npm which feels like overkill
    
    * remove bundling
    
    * fix workflow
    
    * goddammit vscode grow up. just add the extension. sheesh
    
    * update tests
    
    * pin vite version for now, to avoid distracting test failures
    
    * fix
    
    * add unused prepare script
    
    Co-authored-by: Rich Harris <hello@rich-harris.dev>
    dummdidumm and Rich-Harris authored Aug 17, 2022
    Copy the full SHA
    89ef569 View commit details
  4. avoid double import of $env/dynamic/[mode] modules (#5955)

    * WIP
    
    * this might work?
    
    * changeset
    
    * hoist, so returned function is sync
    Rich-Harris authored Aug 17, 2022
    Copy the full SHA
    fa76c2c View commit details
  5. Copy the full SHA
    d4d9af0 View commit details
  6. Version Packages (next) (#5984)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Aug 17, 2022
    Copy the full SHA
    72b29fa View commit details
Showing with 984 additions and 362 deletions.
  1. +5 −0 .changeset/chilled-years-smash.md
  2. +5 −0 .changeset/nasty-shoes-mate.md
  3. +5 −1 .changeset/pre.json
  4. +5 −0 .changeset/sour-cherries-play.md
  5. +1 −1 .gitignore
  6. +3 −3 .prettierrc
  7. +6 −4 documentation/docs/13-packaging.md
  8. +19 −17 documentation/docs/15-configuration.md
  9. +1 −1 packages/adapter-static/package.json
  10. +1 −1 packages/adapter-static/test/apps/prerendered/package.json
  11. +1 −1 packages/adapter-static/test/apps/spa/package.json
  12. +6 −0 packages/create-svelte/CHANGELOG.md
  13. +22 −2 packages/create-svelte/index.js
  14. +1 −1 packages/create-svelte/package.json
  15. +14 −0 packages/create-svelte/shared/+libskeleton+checkjs/jsconfig.json
  16. +14 −0 packages/create-svelte/shared/+libskeleton+typescript/tsconfig.json
  17. 0 packages/create-svelte/shared/{+skeleton+typescript → +typescript}/svelte.config.js
  18. 0 packages/create-svelte/shared/{+skeleton-typescript → -typescript}/svelte.config.js
  19. +0 −1 packages/create-svelte/templates/default/package.json
  20. +7 −7 packages/create-svelte/templates/default/src/lib/form.ts
  21. +8 −0 packages/create-svelte/templates/libskeleton/.gitignore
  22. +3 −0 packages/create-svelte/templates/libskeleton/.ignore
  23. +4 −0 packages/create-svelte/templates/libskeleton/.meta.json
  24. +1 −0 packages/create-svelte/templates/libskeleton/.npmrc
  25. +18 −0 packages/create-svelte/templates/libskeleton/package.template.json
  26. +11 −0 packages/create-svelte/templates/libskeleton/src/app.d.ts
  27. +12 −0 packages/create-svelte/templates/libskeleton/src/app.html
  28. +1 −0 packages/create-svelte/templates/libskeleton/src/lib/index.js
  29. +3 −0 packages/create-svelte/templates/libskeleton/src/routes/+page.svelte
  30. BIN packages/create-svelte/templates/libskeleton/static/favicon.png
  31. +12 −0 packages/create-svelte/templates/libskeleton/svelte.config.js
  32. +8 −0 packages/create-svelte/templates/libskeleton/vite.config.js
  33. +1 −1 packages/create-svelte/templates/skeleton/package.template.json
  34. +3 −2 packages/create-svelte/types/internal.d.ts
  35. +8 −0 packages/kit/CHANGELOG.md
  36. +5 −6 packages/kit/package.json
  37. +8 −15 packages/kit/src/cli.js
  38. +2 −9 packages/kit/src/core/config/index.spec.js
  39. +1 −7 packages/kit/src/core/config/options.js
  40. +40 −9 packages/kit/src/core/sync/write_types.js
  41. +0 −3 packages/kit/src/packaging/test/errors/duplicate-export/tsconfig.json
  42. +0 −3 packages/kit/src/packaging/test/errors/no-lib-folder/tsconfig.json
  43. +0 −3 packages/kit/src/packaging/test/fixtures/assets/jsconfig.json
  44. +0 −10 packages/kit/src/packaging/test/fixtures/emitTypes-false/svelte.config.js
  45. +0 −3 packages/kit/src/packaging/test/fixtures/exports-merge/jsconfig.json
  46. +0 −3 packages/kit/src/packaging/test/fixtures/exports-replace/jsconfig.json
  47. +0 −10 packages/kit/src/packaging/test/fixtures/exports-replace/svelte.config.js
  48. +0 −3 packages/kit/src/packaging/test/fixtures/files-exclude/jsconfig.json
  49. +0 −14 packages/kit/src/packaging/test/fixtures/files-exclude/svelte.config.js
  50. +0 −3 packages/kit/src/packaging/test/fixtures/javascript/jsconfig.json
  51. +0 −3 packages/kit/src/packaging/test/fixtures/resolve-alias/tsconfig.json
  52. +0 −3 packages/kit/src/packaging/test/fixtures/typescript/tsconfig.json
  53. +0 −8 packages/kit/src/packaging/types.d.ts
  54. +1 −1 packages/kit/src/runtime/client/client.js
  55. +2 −2 packages/kit/src/runtime/client/types.d.ts
  56. +3 −1 packages/kit/src/runtime/server/endpoint.js
  57. +1 −1 packages/kit/src/runtime/server/index.js
  58. +2 −2 packages/kit/src/runtime/server/page/index.js
  59. +3 −3 packages/kit/src/runtime/server/page/load_data.js
  60. +1 −1 packages/kit/src/runtime/server/page/render.js
  61. +2 −2 packages/kit/src/runtime/server/page/types.d.ts
  62. +1 −1 packages/kit/src/utils/escape.js
  63. +14 −14 packages/kit/src/vite/dev/index.js
  64. +1 −1 packages/kit/test/apps/amp/package.json
  65. +1 −1 packages/kit/test/apps/basics/package.json
  66. +1 −1 packages/kit/test/apps/options-2/package.json
  67. +1 −1 packages/kit/test/apps/options/package.json
  68. +1 −1 packages/kit/test/apps/writes/package.json
  69. +1 −1 packages/kit/test/prerendering/basics/package.json
  70. +1 −1 packages/kit/test/prerendering/fallback/package.json
  71. +1 −1 packages/kit/test/prerendering/options/package.json
  72. +1 −1 packages/kit/test/prerendering/paths-base/package.json
  73. +1 −1 packages/kit/test/prerendering/trailing-slash/package.json
  74. +1 −2 packages/kit/tsconfig.json
  75. +27 −26 packages/kit/types/index.d.ts
  76. +0 −27 packages/kit/types/private.d.ts
  77. +12 −0 packages/package/.gitignore
  78. +18 −0 packages/package/README.md
  79. +52 −0 packages/package/package.json
  80. +33 −0 packages/package/src/cli.js
  81. +38 −0 packages/package/src/config.js
  82. +108 −0 packages/package/src/filesystem.js
  83. +13 −17 packages/{kit/src/packaging → package/src}/index.js
  84. +27 −0 packages/package/src/types.d.ts
  85. +14 −30 packages/{kit/src/packaging → package/src}/typescript.js
  86. +9 −9 packages/{kit/src/packaging → package/src}/utils.js
  87. +2 −0 packages/package/svelte-package.js
  88. 0 packages/{kit/src/packaging → package}/test/errors/duplicate-export/jsconfig.json
  89. 0 packages/{kit/src/packaging → package}/test/errors/duplicate-export/package.json
  90. 0 packages/{kit/src/packaging → package}/test/errors/duplicate-export/src/lib/utils.ts
  91. 0 packages/{kit/src/packaging → package}/test/errors/duplicate-export/src/lib/utils/index.js
  92. 0 packages/{kit/src/packaging → package}/test/errors/duplicate-export/svelte.config.js
  93. +10 −0 packages/package/test/errors/duplicate-export/tsconfig.json
  94. 0 packages/{kit/src/packaging → package}/test/errors/no-lib-folder/package.json
  95. 0 packages/{kit/src/packaging → package}/test/errors/no-lib-folder/svelte.config.js
  96. +10 −0 packages/package/test/errors/no-lib-folder/tsconfig.json
  97. BIN packages/{kit/src/packaging → package}/test/fixtures/assets/expected/kit.png
  98. 0 packages/{kit/src/packaging → package}/test/fixtures/assets/expected/package.json
  99. +1 −0 packages/package/test/fixtures/assets/jsconfig.json
  100. 0 packages/{kit/src/packaging → package}/test/fixtures/assets/package.json
  101. BIN packages/{kit/src/packaging → package}/test/fixtures/assets/src/lib/kit.png
  102. 0 packages/{kit/src/packaging → package}/test/fixtures/assets/svelte.config.js
  103. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/expected/Test.svelte
  104. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/expected/Test2.svelte
  105. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/expected/foo.d.ts
  106. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/expected/index.js
  107. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/expected/package.json
  108. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/package.json
  109. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/src/lib/Test.svelte
  110. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/src/lib/Test2.svelte
  111. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/src/lib/foo.d.ts
  112. 0 packages/{kit/src/packaging → package}/test/fixtures/emitTypes-false/src/lib/index.js
  113. +7 −0 packages/package/test/fixtures/emitTypes-false/svelte.config.js
  114. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/Test.svelte
  115. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/Test.svelte.d.ts
  116. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/hello-world.d.ts
  117. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/hello-world.js
  118. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/icons123.d.ts
  119. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/icons123.js
  120. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/index.d.ts
  121. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/index.js
  122. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/internal/Test.svelte
  123. 0 ...ages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/internal/Test.svelte.d.ts
  124. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/internal/_Private.svelte
  125. 0 .../{kit/src/packaging → package}/test/fixtures/exports-merge/expected/internal/_Private.svelte.d.ts
  126. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/internal/constants.d.ts
  127. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/internal/constants.js
  128. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/internal/foo.d.ts
  129. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/package.json
  130. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/why_underscore.d.ts
  131. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/expected/why_underscore.js
  132. +1 −0 packages/package/test/fixtures/exports-merge/jsconfig.json
  133. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/package.json
  134. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/src/lib/Test.svelte
  135. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/src/lib/hello-world.js
  136. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/src/lib/icons123.js
  137. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/src/lib/index.js
  138. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/src/lib/internal/Test.svelte
  139. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/src/lib/internal/_Private.svelte
  140. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/src/lib/internal/constants.js
  141. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/src/lib/internal/foo.d.ts
  142. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/src/lib/why_underscore.js
  143. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-merge/svelte.config.js
  144. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/expected/Test.svelte
  145. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/expected/Test.svelte.d.ts
  146. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/expected/index.d.ts
  147. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/expected/index.js
  148. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/expected/internal/Test.svelte
  149. 0 ...es/{kit/src/packaging → package}/test/fixtures/exports-replace/expected/internal/Test.svelte.d.ts
  150. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/expected/internal/foo.d.ts
  151. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/expected/package.json
  152. +1 −0 packages/package/test/fixtures/exports-replace/jsconfig.json
  153. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/package.json
  154. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/src/lib/Test.svelte
  155. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/src/lib/index.js
  156. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/src/lib/internal/Test.svelte
  157. 0 packages/{kit/src/packaging → package}/test/fixtures/exports-replace/src/lib/internal/foo.d.ts
  158. +7 −0 packages/package/test/fixtures/exports-replace/svelte.config.js
  159. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/expected/Test.svelte
  160. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/expected/Test.svelte.d.ts
  161. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/expected/index.d.ts
  162. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/expected/index.js
  163. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/expected/internal/index.d.ts
  164. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/expected/internal/index.js
  165. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/expected/package.json
  166. +1 −0 packages/package/test/fixtures/files-exclude/jsconfig.json
  167. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/package.json
  168. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/src/lib/Test.exclude.svelte
  169. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/src/lib/Test.svelte
  170. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/src/lib/check.mjs
  171. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/src/lib/empty/Test.exclude.svelte
  172. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/src/lib/exclude.js
  173. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/src/lib/index.js
  174. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/src/lib/internal/build.mjs
  175. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/src/lib/internal/exclude.js
  176. 0 packages/{kit/src/packaging → package}/test/fixtures/files-exclude/src/lib/internal/index.js
  177. +11 −0 packages/package/test/fixtures/files-exclude/svelte.config.js
  178. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/ReadMe.md
  179. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/ReadMe.md
  180. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/Test.svelte
  181. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/Test.svelte.d.ts
  182. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/Test2.svelte
  183. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/Test2.svelte.d.ts
  184. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/foo.d.ts
  185. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/index.d.ts
  186. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/index.js
  187. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/internal/Test.svelte
  188. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/internal/Test.svelte.d.ts
  189. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/internal/foo.d.ts
  190. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/internal/index.d.ts
  191. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/internal/index.js
  192. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/package.json
  193. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/utils.d.ts
  194. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/expected/utils.js
  195. +1 −0 packages/package/test/fixtures/javascript/jsconfig.json
  196. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/package.json
  197. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/src/lib/Test.svelte
  198. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/src/lib/Test2.svelte
  199. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/src/lib/foo.d.ts
  200. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/src/lib/index.js
  201. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/src/lib/internal/Test.svelte
  202. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/src/lib/internal/foo.d.ts
  203. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/src/lib/internal/index.js
  204. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/src/lib/utils.js
  205. 0 packages/{kit/src/packaging → package}/test/fixtures/javascript/svelte.config.js
  206. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/Test.svelte
  207. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/Test.svelte.d.ts
  208. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/baz.d.ts
  209. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/baz.js
  210. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/index.d.ts
  211. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/index.js
  212. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/package.json
  213. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/sub/bar.d.ts
  214. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/sub/bar.js
  215. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/sub/foo.d.ts
  216. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/expected/sub/foo.js
  217. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/package.json
  218. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/src/lib/Test.svelte
  219. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/src/lib/baz.ts
  220. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/src/lib/index.ts
  221. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/src/lib/sub/bar.ts
  222. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/src/lib/sub/foo.ts
  223. 0 packages/{kit/src/packaging → package}/test/fixtures/resolve-alias/svelte.config.js
  224. +12 −0 packages/package/test/fixtures/resolve-alias/tsconfig.json
  225. +12 −0 packages/package/test/fixtures/svelte-kit/expected/Test.svelte
  226. +40 −0 packages/package/test/fixtures/svelte-kit/expected/Test.svelte.d.ts
  227. 0 ...{kit/src/packaging/test/fixtures/typescript → package/test/fixtures/svelte-kit}/expected/foo.d.ts
  228. 0 ...it/src/packaging/test/fixtures/typescript → package/test/fixtures/svelte-kit}/expected/index.d.ts
  229. 0 ...{kit/src/packaging/test/fixtures/typescript → package/test/fixtures/svelte-kit}/expected/index.js
  230. +13 −0 packages/package/test/fixtures/svelte-kit/expected/package.json
  231. +1 −0 packages/package/test/fixtures/svelte-kit/jsconfig.json
  232. +7 −0 packages/package/test/fixtures/svelte-kit/package.json
  233. +12 −0 packages/package/test/fixtures/svelte-kit/src/kitlib/Test.svelte
  234. 0 ...ackaging/test/fixtures/typescript/src/lib → package/test/fixtures/svelte-kit/src/kitlib}/foo.d.ts
  235. 0 ...test/fixtures/typescript/src/lib/index.ts → package/test/fixtures/svelte-kit/src/kitlib/index.js}
  236. +7 −0 packages/package/test/fixtures/svelte-kit/svelte.config.js
  237. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/expected/Plain.svelte
  238. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/expected/Plain.svelte.d.ts
  239. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/expected/Test.svelte
  240. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/expected/Test.svelte.d.ts
  241. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/expected/Test2.svelte
  242. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/expected/Test2.svelte.d.ts
  243. +1 −0 packages/package/test/fixtures/typescript/expected/foo.d.ts
  244. +1 −0 packages/package/test/fixtures/typescript/expected/index.d.ts
  245. +1 −0 packages/package/test/fixtures/typescript/expected/index.js
  246. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/expected/package.json
  247. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/expected/utils.d.ts
  248. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/expected/utils.js
  249. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/package.json
  250. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/src/lib/Plain.svelte
  251. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/src/lib/Test.svelte
  252. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/src/lib/Test2.svelte
  253. +1 −0 packages/package/test/fixtures/typescript/src/lib/foo.d.ts
  254. +1 −0 packages/package/test/fixtures/typescript/src/lib/index.ts
  255. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/src/lib/utils.ts
  256. 0 packages/{kit/src/packaging → package}/test/fixtures/typescript/svelte.config.js
  257. +6 −0 packages/package/test/fixtures/typescript/tsconfig.json
  258. +10 −6 packages/{kit/src/packaging → package}/test/index.js
  259. 0 packages/{kit/src/packaging → package}/test/watch/expected/Test.svelte
  260. 0 packages/{kit/src/packaging → package}/test/watch/expected/Test.svelte.d.ts
  261. 0 packages/{kit/src/packaging → package}/test/watch/expected/a.d.ts
  262. 0 packages/{kit/src/packaging → package}/test/watch/expected/a.js
  263. 0 packages/{kit/src/packaging → package}/test/watch/expected/b.d.ts
  264. 0 packages/{kit/src/packaging → package}/test/watch/expected/b.js
  265. 0 packages/{kit/src/packaging → package}/test/watch/expected/index.js
  266. 0 packages/{kit/src/packaging → package}/test/watch/expected/package.json
  267. 0 packages/{kit/src/packaging → package}/test/watch/package.json
  268. 0 packages/{kit/src/packaging → package}/test/watch/src/lib/index.js
  269. 0 packages/{kit/src/packaging → package}/test/watch/svelte.config.js
  270. +3 −2 packages/{kit/src/packaging → package}/test/watch/tsconfig.json
  271. +18 −0 packages/package/tsconfig.json
  272. +34 −0 packages/package/types/index.d.ts
  273. +95 −47 pnpm-lock.yaml
5 changes: 5 additions & 0 deletions .changeset/chilled-years-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-svelte": patch
---

make variable names more descriptive
5 changes: 5 additions & 0 deletions .changeset/nasty-shoes-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Prevent double import of env modules
6 changes: 5 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -30,7 +30,8 @@
"prerendering-test-disabled": "0.0.2-next.0",
"test-writes": "0.0.2-next.0",
"svelte-migrate": "1.0.0-next.0",
"skeleton-template": "0.0.1-next.0"
"skeleton-template": "0.0.1-next.0",
"@sveltejs/package": "1.0.0-next.1"
},
"changesets": [
"afraid-eels-tease",
@@ -122,6 +123,7 @@
"chilled-moons-sniff",
"chilled-rivers-talk",
"chilled-starfishes-jog",
"chilled-years-smash",
"chilled-zebras-check",
"chilly-cars-battle",
"chilly-files-greet",
@@ -574,6 +576,7 @@
"nasty-llamas-lay",
"nasty-seahorses-know",
"nasty-seas-reflect",
"nasty-shoes-mate",
"nasty-trees-cheer",
"nasty-waves-kneel",
"neat-cups-begin",
@@ -899,6 +902,7 @@
"soft-months-fail",
"soft-news-teach",
"soft-students-cover",
"sour-cherries-play",
"sour-hounds-punch",
"sour-needles-compete",
"sour-penguins-admire",
5 changes: 5 additions & 0 deletions .changeset/sour-cherries-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Tighten up params typings, fix load function typings, add event typings to generated types
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ test-results/
package-lock.json
yarn.lock
/packages/create-svelte/template/CHANGELOG.md
/packages/kit/src/packaging/test/watch/package
/packages/package/test/**/package
/documentation/types.js
.env
.vercel_build_output
6 changes: 3 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -21,9 +21,9 @@
"files": [
"**/CHANGELOG.md",
"**/.svelte-kit/**",
"packages/kit/src/packaging/test/fixtures/**/expected/**/*",
"packages/kit/src/packaging/test/watch/expected/**/*",
"packages/kit/src/packaging/test/watch/package/**/*",
"packages/package/test/fixtures/**/expected/**/*",
"packages/package/test/watch/expected/**/*",
"packages/package/test/watch/package/**/*",
"packages/kit/src/core/prerender/fixtures/**/*",
"packages/migrate/migrations/routes/*/samples.md"
],
10 changes: 6 additions & 4 deletions documentation/docs/13-packaging.md
Original file line number Diff line number Diff line change
@@ -2,18 +2,18 @@
title: Packaging
---

> `svelte-kit package` is currently experimental and is not subject to Semantic Versioning rules. Non-backward compatible changes may occur in any future release.
> `svelte-package` is currently experimental. Non-backward compatible changes may occur in any future release.
You can use SvelteKit to build component libraries as well as apps.
You can use SvelteKit to build apps as well as component libraries, using the `@sveltejs/package` package (`npm create svelte` has an option to set this up for you).

When you're creating an app, the contents of `src/routes` is the public-facing stuff; [`src/lib`](/docs/modules#$lib) contains your app's internal library.

A SvelteKit component library has the exact same structure as a SvelteKit app, except that `src/lib` is the public-facing bit. `src/routes` might be a documentation or demo site that accompanies the library, or it might just be a sandbox you use during development.

Running `svelte-kit package` will take the contents of `src/lib` and generate a `package` directory (which can be [configured](/docs/configuration#package)) containing the following:
Running the `svelte-package` command from `@sveltejs/package` will take the contents of `src/lib` and generate a `package` directory (which can be [configured](/docs/configuration#package)) containing the following:

- All the files in `src/lib`, unless you [configure](/docs/configuration#package) custom `include`/`exclude` options. Svelte components will be preprocessed, TypeScript files will be transpiled to JavaScript.
- Type definitions (`d.ts` files) which are generated for Svelte, JavaScript and TypeScript files. You need to install `typescript >= 4.0.0` and `svelte2tsx >= 0.4.1` for this. Type definitions are placed next to their implementation, hand-written `d.ts` files are copied over as is. You can [disable generation](/docs/configuration#package), but we strongly recommend against it.
- Type definitions (`d.ts` files) which are generated for Svelte, JavaScript and TypeScript files. You need to install `typescript >= 4.0.0` for this. Type definitions are placed next to their implementation, hand-written `d.ts` files are copied over as is. You can [disable generation](/docs/configuration#package), but we strongly recommend against it.
- A `package.json` copied from the project root with all fields except `"scripts"`, `"publishConfig.directory"` and `"publishConfig.linkDirectory"`. The `"dependencies"` field is included, which means you should add packages that you only need for your documentation or demo site to `"devDependencies"`. A `"type": "module"` and an `"exports"` field will be added if it's not defined in the original file.

The `"exports"` field contains the package's entry points. By default, all files in `src/lib` will be treated as an entry point unless they start with (or live in a directory that starts with) an underscore, but you can [configure](/docs/configuration#package) this behaviour. If you have a `src/lib/index.js` or `src/lib/index.svelte` file, it will be treated as the package root.
@@ -50,4 +50,6 @@ The `./package` above is referring to the directory name generated, change accor

### Caveats

All relative file imports need to be fully specified, adhering to Node's ESM algorithm. This means you cannot import the file `src/lib/something/index.js` like `import { something } from './something`, instead you need to import it like this: `import { something } from './something/index.js`. If you are using TypeScript, you need to import `.ts` files the same way, but using a `.js` file ending, _not_ a `.ts` file ending (this isn't under our control, the TypeScript team has made that decision). Setting `"moduleResolution": "NodeNext"` in your `tsconfig.json` or `jsconfig.json` will help you with this.

This is a relatively experimental feature and is not yet fully implemented. All files except Svelte files (preprocessed) and TypeScript files (transpiled to JavaScript) are copied across as-is.
36 changes: 19 additions & 17 deletions documentation/docs/15-configuration.md
Original file line number Diff line number Diff line change
@@ -48,13 +48,6 @@ const config = {
},
moduleExtensions: ['.js', '.ts'],
outDir: '.svelte-kit',
package: {
dir: 'package',
emitTypes: true,
// excludes all .d.ts and files starting with _ as the name
exports: (filepath) => !/^_|\/_|\.d\.ts$/.test(filepath),
files: () => true
},
paths: {
assets: '',
base: ''
@@ -80,7 +73,17 @@ const config = {
},

// options passed to svelte.preprocess (https://svelte.dev/docs#compile-time-svelte-preprocess)
preprocess: null
preprocess: null,

// options passed to @sveltejs/package
package: {
source: 'value of kit.files.lib, if available, else src/lib',
dir: 'package',
emitTypes: true,
// excludes all .d.ts and files starting with _ as the name
exports: (filepath) => !/^_|\/_|\.d\.ts$/.test(filepath),
files: () => true
}
};

export default config;
@@ -208,8 +211,9 @@ The directory that SvelteKit writes files to during `dev` and `build`. You shoul

Options related to [creating a package](/docs/packaging).

- `source` - library directory
- `dir` - output directory
- `emitTypes` - by default, `svelte-kit package` will automatically generate types for your package in the form of `.d.ts` files. While generating types is configurable, we believe it is best for the ecosystem quality to generate types, always. Please make sure you have a good reason when setting it to `false` (for example when you want to provide handwritten type definitions instead)
- `emitTypes` - by default, `svelte-package` will automatically generate types for your package in the form of `.d.ts` files. While generating types is configurable, we believe it is best for the ecosystem quality to generate types, always. Please make sure you have a good reason when setting it to `false` (for example when you want to provide handwritten type definitions instead)
- `exports` - a function with the type of `(filepath: string) => boolean`. When `true`, the filepath will be included in the `exports` field of the `package.json`. Any existing values in the `package.json` source will be merged with values from the original `exports` field taking precedence
- `files` - a function with the type of `(filepath: string) => boolean`. When `true`, the file will be processed and copied over to the final output folder, specified in `dir`

@@ -226,14 +230,12 @@ import mm from 'micromatch';

/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
package: {
exports: (filepath) => {
if (filepath.endsWith('.d.ts')) return false;
return mm.isMatch(filepath, ['!**/_*', '!**/internal/**']);
},
files: mm.matcher('!**/build.*')
}
package: {
exports: (filepath) => {
if (filepath.endsWith('.d.ts')) return false;
return mm.isMatch(filepath, ['!**/_*', '!**/internal/**']);
},
files: mm.matcher('!**/build.*')
}
};

2 changes: 1 addition & 1 deletion packages/adapter-static/package.json
Original file line number Diff line number Diff line change
@@ -32,6 +32,6 @@
"svelte": "^3.48.0",
"typescript": "^4.7.4",
"uvu": "^0.5.3",
"vite": "^3.0.0"
"vite": "3.0.2"
}
}
2 changes: 1 addition & 1 deletion packages/adapter-static/test/apps/prerendered/package.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
"devDependencies": {
"@sveltejs/kit": "workspace:*",
"svelte": "^3.48.0",
"vite": "^3.0.0"
"vite": "3.0.2"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/adapter-static/test/apps/spa/package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"@sveltejs/kit": "workspace:*",
"sirv-cli": "^2.0.2",
"svelte": "^3.48.0",
"vite": "^3.0.0"
"vite": "3.0.2"
},
"type": "module"
}
6 changes: 6 additions & 0 deletions packages/create-svelte/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# create-svelte

## 2.0.0-next.155

### Patch Changes

- make variable names more descriptive ([#5983](https://github.com/sveltejs/kit/pull/5983))

## 2.0.0-next.154

### Patch Changes
24 changes: 22 additions & 2 deletions packages/create-svelte/index.js
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ function write_common_files(cwd, options, name) {
const pkg_file = path.join(cwd, 'package.json');
const pkg = /** @type {any} */ (JSON.parse(fs.readFileSync(pkg_file, 'utf-8')));

files.forEach((file) => {
sort_files(files).forEach((file) => {
const include = file.include.every((condition) => matches_condition(condition, options));
const exclude = file.exclude.some((condition) => matches_condition(condition, options));

@@ -83,7 +83,7 @@ function write_common_files(cwd, options, name) {
* @returns {boolean}
*/
function matches_condition(condition, options) {
if (condition === 'default' || condition === 'skeleton') {
if (condition === 'default' || condition === 'skeleton' || condition === 'libskeleton') {
return options.template === condition;
}
if (condition === 'typescript' || condition === 'checkjs') {
@@ -135,6 +135,26 @@ function sort_keys(obj) {
return sorted;
}

/**
* Sort files so that those which apply more generically come first so they
* can be overwritten by files for more precise cases later.
*
* @param files {import('./types/internal').Common['files']}
* */
function sort_files(files) {
return files.sort((f1, f2) => {
const f1_more_generic =
f1.include.every((include) => f2.include.includes(include)) &&
f1.exclude.every((exclude) => f2.exclude.includes(exclude));
const f2_more_generic =
f2.include.every((include) => f1.include.includes(include)) &&
f2.exclude.every((exclude) => f1.exclude.includes(exclude));
const same = f1_more_generic && f2_more_generic;
const different = !f1_more_generic && !f2_more_generic;
return same || different ? 0 : f1_more_generic ? -1 : 1;
});
}

/** @param {string} name */
function to_valid_package_name(name) {
return name
2 changes: 1 addition & 1 deletion packages/create-svelte/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-svelte",
"version": "2.0.0-next.154",
"version": "2.0.0-next.155",
"repository": {
"type": "git",
"url": "https://github.com/sveltejs/kit",
14 changes: 14 additions & 0 deletions packages/create-svelte/shared/+libskeleton+checkjs/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "NodeNext"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "NodeNext"
}
}
1 change: 0 additions & 1 deletion packages/create-svelte/templates/default/package.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"package": "svelte-kit package",
"preview": "vite preview"
},
"devDependencies": {
14 changes: 7 additions & 7 deletions packages/create-svelte/templates/default/src/lib/form.ts
Original file line number Diff line number Diff line change
@@ -60,11 +60,11 @@ export function enhance(
) {
let current_token: unknown;

/** @param {SubmitEvent} e */
async function handle_submit(e: SubmitEvent) {
/** @param {SubmitEvent} event */
async function handle_submit(event: SubmitEvent) {
const token = (current_token = {});

e.preventDefault();
event.preventDefault();

const data = new FormData(form);

@@ -92,11 +92,11 @@ export function enhance(
} else {
console.error(await response.text());
}
} catch (e: unknown) {
if (error && e instanceof Error) {
error({ data, form, error: e, response: null });
} catch (err: unknown) {
if (error && err instanceof Error) {
error({ data, form, error: err, response: null });
} else {
throw e;
throw err;
}
}
}
8 changes: 8 additions & 0 deletions packages/create-svelte/templates/libskeleton/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
3 changes: 3 additions & 0 deletions packages/create-svelte/templates/libskeleton/.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package.json
.meta.json
.turbo
4 changes: 4 additions & 0 deletions packages/create-svelte/templates/libskeleton/.meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"title": "Library skeleton project",
"description": "Barebones scaffolding for your new Svelte library"
}
1 change: 1 addition & 0 deletions packages/create-svelte/templates/libskeleton/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
18 changes: 18 additions & 0 deletions packages/create-svelte/templates/libskeleton/package.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "~TODO~",
"version": "0.0.1",
"scripts": {
"dev": "vite dev",
"build": "svelte-kit sync && svelte-package"
},
"devDependencies": {
"@sveltejs/adapter-auto": "workspace:*",
"@sveltejs/kit": "workspace:*",
"@sveltejs/package": "workspace:*",
"svelte": "^3.44.0",
"tslib": "^2.3.1",
"typescript": "^4.7.4",
"vite": "^3.0.0"
},
"type": "module"
}
11 changes: 11 additions & 0 deletions packages/create-svelte/templates/libskeleton/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// <reference types="@sveltejs/kit" />

// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Locals {}
// interface Platform {}
// interface Session {}
// interface Stuff {}
}
12 changes: 12 additions & 0 deletions packages/create-svelte/templates/libskeleton/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body>
<div>%sveltekit.body%</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Reexport your entry components here
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1>Welcome to your library project</h1>
<p>Create your package using @sveltejs/package and preview/showcase your work with SvelteKit</p>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading