expeditaea 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1365) hide show
  1. package/.all-contributorsrc +135 -0
  2. package/.editorconfig +13 -0
  3. package/.eslintignore +16 -0
  4. package/.eslintrc.js +92 -0
  5. package/.github/FUNDING.yml +7 -0
  6. package/.github/ISSUE_TEMPLATE/bug-report.md +47 -0
  7. package/.github/ISSUE_TEMPLATE/config.yml +6 -0
  8. package/.github/ISSUE_TEMPLATE/feature-request.md +26 -0
  9. package/.github/PULL_REQUEST_TEMPLATE.md +24 -0
  10. package/.github/lock.yml +9 -0
  11. package/.github/nuxt.png +0 -0
  12. package/.github/stale.yml +24 -0
  13. package/.github/workflows/nightly.yml +49 -0
  14. package/.github/workflows/test.yml +355 -0
  15. package/.github/workflows/windows.yml +165 -0
  16. package/.gitpod.yml +6 -0
  17. package/.ls-lint.yml +8 -0
  18. package/.yarnrc +1 -0
  19. package/babel.config.js +18 -0
  20. package/benchmarks/README.md +29 -0
  21. package/benchmarks/package.json +10 -0
  22. package/benchmarks/pages/stateless-big.vue +7 -0
  23. package/benchmarks/pages/stateless.vue +3 -0
  24. package/distributions/nuxt/README.md +153 -0
  25. package/distributions/nuxt/bin/nuxt.js +10 -0
  26. package/distributions/nuxt/package.js +29 -0
  27. package/distributions/nuxt/package.json +54 -0
  28. package/distributions/nuxt/src/index.js +5 -0
  29. package/distributions/nuxt/webpack.config.js +4 -0
  30. package/distributions/nuxt-start/README.md +42 -0
  31. package/distributions/nuxt-start/bin/nuxt-start.js +14 -0
  32. package/distributions/nuxt-start/package.js +42 -0
  33. package/distributions/nuxt-start/package.json +44 -0
  34. package/distributions/nuxt-start/src/index.js +1 -0
  35. package/examples/async-component-injection/README.md +3 -0
  36. package/examples/async-component-injection/assets/css/common.css +69 -0
  37. package/examples/async-component-injection/assets/css/index.css +57 -0
  38. package/examples/async-component-injection/assets/css/post.css +307 -0
  39. package/examples/async-component-injection/assets/img/github.png +0 -0
  40. package/examples/async-component-injection/assets/img/swimmer.jpg +0 -0
  41. package/examples/async-component-injection/assets/img/twitter.png +0 -0
  42. package/examples/async-component-injection/layouts/default.vue +20 -0
  43. package/examples/async-component-injection/nuxt.config.js +22 -0
  44. package/examples/async-component-injection/package.json +12 -0
  45. package/examples/async-component-injection/pages/_slug.vue +21 -0
  46. package/examples/async-component-injection/pages/index.vue +30 -0
  47. package/examples/async-component-injection/posts/404.vue +5 -0
  48. package/examples/async-component-injection/posts/deep-dive-into-ocean.vue +19 -0
  49. package/examples/async-component-injection/posts/welcome-to-my-blog.vue +12 -0
  50. package/examples/async-component-injection/static/favicon.ico +0 -0
  51. package/examples/async-data/README.md +3 -0
  52. package/examples/async-data/nuxt.config.js +15 -0
  53. package/examples/async-data/package.json +13 -0
  54. package/examples/async-data/pages/index.vue +35 -0
  55. package/examples/async-data/pages/posts/_id.vue +55 -0
  56. package/examples/async-data/pages/posts/index.vue +64 -0
  57. package/examples/auth-jwt/README.md +3 -0
  58. package/examples/auth-jwt/middleware/authenticated.js +6 -0
  59. package/examples/auth-jwt/middleware/notAuthenticated.js +6 -0
  60. package/examples/auth-jwt/package.json +14 -0
  61. package/examples/auth-jwt/pages/index.vue +34 -0
  62. package/examples/auth-jwt/pages/login.vue +37 -0
  63. package/examples/auth-jwt/pages/secret.vue +14 -0
  64. package/examples/auth-jwt/store/index.js +26 -0
  65. package/examples/auth-routes/README.md +3 -0
  66. package/examples/auth-routes/api/index.js +36 -0
  67. package/examples/auth-routes/middleware/auth.js +8 -0
  68. package/examples/auth-routes/nuxt.config.js +32 -0
  69. package/examples/auth-routes/package.json +16 -0
  70. package/examples/auth-routes/pages/index.vue +72 -0
  71. package/examples/auth-routes/pages/secret.vue +15 -0
  72. package/examples/auth-routes/store/index.js +37 -0
  73. package/examples/axios/README.md +38 -0
  74. package/examples/axios/nuxt.config.js +9 -0
  75. package/examples/axios/package.json +15 -0
  76. package/examples/axios/pages/index.vue +17 -0
  77. package/examples/cached-components/README.md +1 -0
  78. package/examples/cached-components/nuxt.config.js +10 -0
  79. package/examples/cached-components/package.json +13 -0
  80. package/examples/cached-components/pages/index.vue +20 -0
  81. package/examples/coffeescript/README.md +22 -0
  82. package/examples/coffeescript/components/Logo.vue +79 -0
  83. package/examples/coffeescript/layouts/default.vue +52 -0
  84. package/examples/coffeescript/modules/coffeescript.js +17 -0
  85. package/examples/coffeescript/nuxt.config.js +24 -0
  86. package/examples/coffeescript/package.json +20 -0
  87. package/examples/coffeescript/pages/README.md +7 -0
  88. package/examples/coffeescript/pages/index.vue +58 -0
  89. package/examples/coffeescript/static/favicon.ico +0 -0
  90. package/examples/coffeescript/store/index.coffee +2 -0
  91. package/examples/custom-build/README.md +1 -0
  92. package/examples/custom-build/assets/nuxt.png +0 -0
  93. package/examples/custom-build/nuxt.config.js +26 -0
  94. package/examples/custom-build/package.json +13 -0
  95. package/examples/custom-build/pages/index.vue +15 -0
  96. package/examples/custom-layouts/README.md +5 -0
  97. package/examples/custom-layouts/layouts/dark.vue +24 -0
  98. package/examples/custom-layouts/layouts/default.vue +15 -0
  99. package/examples/custom-layouts/layouts/error.vue +35 -0
  100. package/examples/custom-layouts/package.json +12 -0
  101. package/examples/custom-layouts/pages/about.vue +19 -0
  102. package/examples/custom-layouts/pages/index.vue +8 -0
  103. package/examples/custom-layouts/static/logo.png +0 -0
  104. package/examples/custom-loading/README.md +3 -0
  105. package/examples/custom-loading/components/loading.vue +36 -0
  106. package/examples/custom-loading/nuxt.config.js +3 -0
  107. package/examples/custom-loading/package.json +12 -0
  108. package/examples/custom-loading/pages/about.vue +28 -0
  109. package/examples/custom-loading/pages/index.vue +28 -0
  110. package/examples/custom-page-loading/README.md +5 -0
  111. package/examples/custom-page-loading/package.json +12 -0
  112. package/examples/custom-page-loading/pages/about.vue +53 -0
  113. package/examples/custom-page-loading/pages/final.vue +21 -0
  114. package/examples/custom-page-loading/pages/index.vue +28 -0
  115. package/examples/custom-port-host/README.md +3 -0
  116. package/examples/custom-port-host/nuxt.config.js +6 -0
  117. package/examples/custom-port-host/package.json +12 -0
  118. package/examples/custom-port-host/pages/index.vue +3 -0
  119. package/examples/custom-routes/README.md +3 -0
  120. package/examples/custom-routes/nuxt.config.js +2 -0
  121. package/examples/custom-routes/package.json +13 -0
  122. package/examples/custom-routes/pages/index.vue +46 -0
  123. package/examples/custom-routes/pages/users/_id.vue +38 -0
  124. package/examples/custom-server/README.md +3 -0
  125. package/examples/custom-server/nuxt.config.js +1 -0
  126. package/examples/custom-server/package.json +13 -0
  127. package/examples/custom-server/pages/index.vue +7 -0
  128. package/examples/custom-server/server.js +25 -0
  129. package/examples/custom-template/app.html +13 -0
  130. package/examples/custom-template/nuxt.config.js +5 -0
  131. package/examples/custom-template/package.json +12 -0
  132. package/examples/custom-template/pages/index.vue +5 -0
  133. package/examples/docker-build/.dockerignore +84 -0
  134. package/examples/docker-build/.yarnclean +5 -0
  135. package/examples/docker-build/Dockerfile +31 -0
  136. package/examples/docker-build/README.md +12 -0
  137. package/examples/docker-build/assets/README.md +1 -0
  138. package/examples/docker-build/components/README.md +1 -0
  139. package/examples/docker-build/layouts/README.md +1 -0
  140. package/examples/docker-build/layouts/default.vue +8 -0
  141. package/examples/docker-build/middleware/README.md +1 -0
  142. package/examples/docker-build/nuxt.config.js +54 -0
  143. package/examples/docker-build/package.json +15 -0
  144. package/examples/docker-build/pages/README.md +1 -0
  145. package/examples/docker-build/pages/index.vue +12 -0
  146. package/examples/docker-build/plugins/README.md +1 -0
  147. package/examples/docker-build/static/README.md +1 -0
  148. package/examples/docker-build/static/favicon.ico +0 -0
  149. package/examples/docker-build/store/README.md +1 -0
  150. package/examples/dynamic-components/README.md +5 -0
  151. package/examples/dynamic-components/components/chart.js +9 -0
  152. package/examples/dynamic-components/components/code.vue +23 -0
  153. package/examples/dynamic-components/components/image.vue +71 -0
  154. package/examples/dynamic-components/components/text.vue +22 -0
  155. package/examples/dynamic-components/js/messages.js +27 -0
  156. package/examples/dynamic-components/nuxt.config.js +9 -0
  157. package/examples/dynamic-components/package.json +15 -0
  158. package/examples/dynamic-components/pages/index.vue +71 -0
  159. package/examples/dynamic-components/pages/ssr.vue +63 -0
  160. package/examples/dynamic-layouts/README.md +3 -0
  161. package/examples/dynamic-layouts/layouts/error.vue +36 -0
  162. package/examples/dynamic-layouts/layouts/mobile.vue +39 -0
  163. package/examples/dynamic-layouts/middleware/mobile.js +4 -0
  164. package/examples/dynamic-layouts/nuxt.config.js +10 -0
  165. package/examples/dynamic-layouts/package.json +12 -0
  166. package/examples/dynamic-layouts/pages/about.vue +19 -0
  167. package/examples/dynamic-layouts/pages/index.vue +14 -0
  168. package/examples/dynamic-layouts/static/logo.png +0 -0
  169. package/examples/global-css/README.md +3 -0
  170. package/examples/global-css/assets/roboto.woff2 +0 -0
  171. package/examples/global-css/css/main.css +22 -0
  172. package/examples/global-css/nuxt.config.js +20 -0
  173. package/examples/global-css/package.json +13 -0
  174. package/examples/global-css/pages/about.vue +17 -0
  175. package/examples/global-css/pages/index.vue +17 -0
  176. package/examples/hello-world/README.md +3 -0
  177. package/examples/hello-world/nuxt.config.js +0 -0
  178. package/examples/hello-world/package.json +12 -0
  179. package/examples/hello-world/pages/about.vue +21 -0
  180. package/examples/hello-world/pages/index.vue +16 -0
  181. package/examples/i18n/README.md +5 -0
  182. package/examples/i18n/layouts/default.vue +95 -0
  183. package/examples/i18n/locales/en.json +16 -0
  184. package/examples/i18n/locales/fr.json +16 -0
  185. package/examples/i18n/middleware/i18n.js +21 -0
  186. package/examples/i18n/nuxt.config.js +10 -0
  187. package/examples/i18n/package.json +14 -0
  188. package/examples/i18n/pages/_lang/about.vue +18 -0
  189. package/examples/i18n/pages/_lang/index.vue +18 -0
  190. package/examples/i18n/pages/about.vue +4 -0
  191. package/examples/i18n/pages/index.vue +4 -0
  192. package/examples/i18n/plugins/i18n.js +25 -0
  193. package/examples/i18n/store/index.js +12 -0
  194. package/examples/jest-puppeteer/README.md +43 -0
  195. package/examples/jest-puppeteer/jest-puppeteer.config.js +10 -0
  196. package/examples/jest-puppeteer/jest.config.js +4 -0
  197. package/examples/jest-puppeteer/package.json +19 -0
  198. package/examples/jest-puppeteer/pages/about.vue +23 -0
  199. package/examples/jest-puppeteer/pages/index.vue +16 -0
  200. package/examples/jest-puppeteer/test/__snapshots__/index.spec.js.snap +5 -0
  201. package/examples/jest-puppeteer/test/index.spec.js +32 -0
  202. package/examples/jest-vtu-example/.eslintignore +1 -0
  203. package/examples/jest-vtu-example/README.md +13 -0
  204. package/examples/jest-vtu-example/babel.config.js +7 -0
  205. package/examples/jest-vtu-example/components/Btn/Btn.spec.js +34 -0
  206. package/examples/jest-vtu-example/components/Btn/Btn.vue +25 -0
  207. package/examples/jest-vtu-example/components/Btn/__snapshots__/Btn.spec.js.snap +7 -0
  208. package/examples/jest-vtu-example/layouts/default.vue +5 -0
  209. package/examples/jest-vtu-example/nuxt.config.js +3 -0
  210. package/examples/jest-vtu-example/package.json +47 -0
  211. package/examples/jest-vtu-example/pages/__snapshots__/index.spec.js.snap +12 -0
  212. package/examples/jest-vtu-example/pages/index.spec.js +14 -0
  213. package/examples/jest-vtu-example/pages/index.vue +20 -0
  214. package/examples/jsx/README.md +7 -0
  215. package/examples/jsx/components/test.vue +22 -0
  216. package/examples/jsx/package.json +12 -0
  217. package/examples/jsx/pages/about.js +21 -0
  218. package/examples/jsx/pages/index.js +20 -0
  219. package/examples/layout-transitions/README.md +3 -0
  220. package/examples/layout-transitions/assets/main.css +52 -0
  221. package/examples/layout-transitions/layouts/secondary.vue +6 -0
  222. package/examples/layout-transitions/nuxt.config.js +7 -0
  223. package/examples/layout-transitions/package.json +12 -0
  224. package/examples/layout-transitions/pages/about.vue +18 -0
  225. package/examples/layout-transitions/pages/index.vue +28 -0
  226. package/examples/layout-transitions/pages/users-2.vue +104 -0
  227. package/examples/layout-transitions/pages/users.vue +89 -0
  228. package/examples/markdownit/README.md +5 -0
  229. package/examples/markdownit/nuxt.config.js +8 -0
  230. package/examples/markdownit/package.json +18 -0
  231. package/examples/markdownit/pages/about.vue +6 -0
  232. package/examples/markdownit/pages/index.vue +19 -0
  233. package/examples/markdownit/pages/pug.vue +20 -0
  234. package/examples/markdownit/plugins/md-it.js +5 -0
  235. package/examples/meta-info/README.md +13 -0
  236. package/examples/meta-info/components/twitter-head-card.vue +22 -0
  237. package/examples/meta-info/nuxt.config.js +13 -0
  238. package/examples/meta-info/package.json +12 -0
  239. package/examples/meta-info/pages/about.vue +36 -0
  240. package/examples/meta-info/pages/index.vue +36 -0
  241. package/examples/meta-info/static/about.js +1 -0
  242. package/examples/meta-info/static/body.js +1 -0
  243. package/examples/meta-info/static/defer.js +1 -0
  244. package/examples/meta-info/static/head.js +1 -0
  245. package/examples/middleware/README.md +6 -0
  246. package/examples/middleware/components/Visits.vue +42 -0
  247. package/examples/middleware/layouts/default.vue +14 -0
  248. package/examples/middleware/middleware/user-agent.js +3 -0
  249. package/examples/middleware/middleware/visits.js +3 -0
  250. package/examples/middleware/nuxt.config.js +5 -0
  251. package/examples/middleware/package.json +12 -0
  252. package/examples/middleware/pages/_slug.vue +33 -0
  253. package/examples/middleware/store/index.js +12 -0
  254. package/examples/minimal-features/README.md +3 -0
  255. package/examples/minimal-features/nuxt.config.js +28 -0
  256. package/examples/minimal-features/package.json +12 -0
  257. package/examples/minimal-features/pages/about.vue +21 -0
  258. package/examples/minimal-features/pages/index.vue +16 -0
  259. package/examples/named-views/README.md +1 -0
  260. package/examples/named-views/components/childLeft.vue +15 -0
  261. package/examples/named-views/components/mainTop.vue +19 -0
  262. package/examples/named-views/layouts/default.vue +6 -0
  263. package/examples/named-views/nuxt.config.js +30 -0
  264. package/examples/named-views/package.json +12 -0
  265. package/examples/named-views/pages/index/child/_id/index.vue +24 -0
  266. package/examples/named-views/pages/index/section.vue +16 -0
  267. package/examples/named-views/pages/index.vue +73 -0
  268. package/examples/named-views/pages/main.vue +50 -0
  269. package/examples/nested-components/README.md +1 -0
  270. package/examples/nested-components/components/paragraph.vue +12 -0
  271. package/examples/nested-components/components/post.vue +32 -0
  272. package/examples/nested-components/package.json +12 -0
  273. package/examples/nested-components/pages/index.vue +54 -0
  274. package/examples/nested-routes/README.md +3 -0
  275. package/examples/nested-routes/nuxt.config.js +29 -0
  276. package/examples/nested-routes/package.json +13 -0
  277. package/examples/nested-routes/pages/index/_id.vue +34 -0
  278. package/examples/nested-routes/pages/index/index.vue +19 -0
  279. package/examples/nested-routes/pages/index.vue +77 -0
  280. package/examples/new-fetch/README.md +5 -0
  281. package/examples/new-fetch/components/Author.vue +30 -0
  282. package/examples/new-fetch/layouts/default.vue +28 -0
  283. package/examples/new-fetch/nuxt.config.js +18 -0
  284. package/examples/new-fetch/package.json +18 -0
  285. package/examples/new-fetch/pages/index.vue +43 -0
  286. package/examples/new-fetch/pages/posts/_id.vue +54 -0
  287. package/examples/new-fetch/plugins/vue-placeholders.js +4 -0
  288. package/examples/no-ssr/README.md +3 -0
  289. package/examples/no-ssr/package.json +12 -0
  290. package/examples/no-ssr/pages/index.vue +17 -0
  291. package/examples/nuxt-prefetch/README.md +3 -0
  292. package/examples/nuxt-prefetch/assets/check.svg +1 -0
  293. package/examples/nuxt-prefetch/layouts/default.vue +57 -0
  294. package/examples/nuxt-prefetch/nuxt.config.js +22 -0
  295. package/examples/nuxt-prefetch/package.json +12 -0
  296. package/examples/nuxt-prefetch/pages/accelerated.vue +17 -0
  297. package/examples/nuxt-prefetch/pages/active.vue +17 -0
  298. package/examples/nuxt-prefetch/pages/agile.vue +17 -0
  299. package/examples/nuxt-prefetch/pages/brisk.vue +17 -0
  300. package/examples/nuxt-prefetch/pages/dashing.vue +17 -0
  301. package/examples/nuxt-prefetch/pages/electric.vue +17 -0
  302. package/examples/nuxt-prefetch/pages/flashing.vue +17 -0
  303. package/examples/nuxt-prefetch/pages/fleet.vue +17 -0
  304. package/examples/nuxt-prefetch/pages/fleeting.vue +17 -0
  305. package/examples/nuxt-prefetch/pages/flying.vue +17 -0
  306. package/examples/nuxt-prefetch/pages/hot.vue +17 -0
  307. package/examples/nuxt-prefetch/pages/hurried.vue +17 -0
  308. package/examples/nuxt-prefetch/pages/index.vue +17 -0
  309. package/examples/nuxt-prefetch/pages/nimble.vue +17 -0
  310. package/examples/nuxt-prefetch/pages/quick.vue +17 -0
  311. package/examples/nuxt-prefetch/pages/racing.vue +17 -0
  312. package/examples/nuxt-prefetch/pages/rapid.vue +17 -0
  313. package/examples/nuxt-prefetch/pages/ready.vue +17 -0
  314. package/examples/nuxt-prefetch/pages/snap.vue +17 -0
  315. package/examples/nuxt-prefetch/pages/swift.vue +17 -0
  316. package/examples/nuxt-prefetch/pages/winged.vue +17 -0
  317. package/examples/nuxt-prefetch/store/index.js +25 -0
  318. package/examples/plugins-vendor/README.md +3 -0
  319. package/examples/plugins-vendor/nuxt.config.js +6 -0
  320. package/examples/plugins-vendor/package.json +15 -0
  321. package/examples/plugins-vendor/pages/about.vue +29 -0
  322. package/examples/plugins-vendor/pages/index.vue +42 -0
  323. package/examples/plugins-vendor/plugins/vue-notifications.js +23 -0
  324. package/examples/programmatic/nuxt.config.js +5 -0
  325. package/examples/programmatic/package.json +12 -0
  326. package/examples/programmatic/pages/index.vue +5 -0
  327. package/examples/programmatic/scripts/build.js +8 -0
  328. package/examples/programmatic/scripts/dev.js +9 -0
  329. package/examples/programmatic/scripts/start.js +8 -0
  330. package/examples/pug/README.md +3 -0
  331. package/examples/pug/package.json +14 -0
  332. package/examples/pug/pages/about.vue +18 -0
  333. package/examples/pug/pages/index.vue +13 -0
  334. package/examples/pug-stylus-coffee/README.md +20 -0
  335. package/examples/pug-stylus-coffee/components/Logo.vue +66 -0
  336. package/examples/pug-stylus-coffee/components/README.md +7 -0
  337. package/examples/pug-stylus-coffee/layouts/README.md +7 -0
  338. package/examples/pug-stylus-coffee/layouts/default.vue +46 -0
  339. package/examples/pug-stylus-coffee/middleware/README.md +8 -0
  340. package/examples/pug-stylus-coffee/modules/coffeescript.js +17 -0
  341. package/examples/pug-stylus-coffee/nuxt.config.coffee +48 -0
  342. package/examples/pug-stylus-coffee/nuxt.config.js +2 -0
  343. package/examples/pug-stylus-coffee/package.json +25 -0
  344. package/examples/pug-stylus-coffee/pages/README.md +7 -0
  345. package/examples/pug-stylus-coffee/pages/index.vue +55 -0
  346. package/examples/pug-stylus-coffee/plugins/README.md +7 -0
  347. package/examples/pug-stylus-coffee/static/README.md +10 -0
  348. package/examples/pug-stylus-coffee/static/favicon.ico +0 -0
  349. package/examples/pug-stylus-coffee/store/README.md +10 -0
  350. package/examples/pug-stylus-coffee/store/index.coffee +3 -0
  351. package/examples/routes-meta/README.md +5 -0
  352. package/examples/routes-meta/layouts/default.vue +73 -0
  353. package/examples/routes-meta/middleware/theme.js +5 -0
  354. package/examples/routes-meta/nuxt.config.js +6 -0
  355. package/examples/routes-meta/package.json +13 -0
  356. package/examples/routes-meta/pages/about.vue +32 -0
  357. package/examples/routes-meta/pages/index.vue +22 -0
  358. package/examples/routes-meta/pages/parent/blue.vue +20 -0
  359. package/examples/routes-meta/pages/parent.vue +18 -0
  360. package/examples/routes-meta/store/index.js +9 -0
  361. package/examples/routes-transitions/README.md +3 -0
  362. package/examples/routes-transitions/assets/main.css +45 -0
  363. package/examples/routes-transitions/nuxt.config.js +3 -0
  364. package/examples/routes-transitions/package.json +12 -0
  365. package/examples/routes-transitions/pages/about.vue +14 -0
  366. package/examples/routes-transitions/pages/index.vue +15 -0
  367. package/examples/routes-transitions/pages/users.vue +87 -0
  368. package/examples/scroll-behavior/README.md +3 -0
  369. package/examples/scroll-behavior/assets/main.css +69 -0
  370. package/examples/scroll-behavior/layouts/default2.vue +3 -0
  371. package/examples/scroll-behavior/nuxt.config.js +4 -0
  372. package/examples/scroll-behavior/package.json +14 -0
  373. package/examples/scroll-behavior/pages/about/contact.vue +13 -0
  374. package/examples/scroll-behavior/pages/about/profile.vue +12 -0
  375. package/examples/scroll-behavior/pages/about.vue +27 -0
  376. package/examples/scroll-behavior/pages/another-long.vue +16 -0
  377. package/examples/scroll-behavior/pages/index.vue +31 -0
  378. package/examples/scroll-behavior/pages/long.vue +42 -0
  379. package/examples/scroll-behavior/pages/users.vue +87 -0
  380. package/examples/spa/README.md +2 -0
  381. package/examples/spa/assets/main.css +6 -0
  382. package/examples/spa/nuxt.config.js +41 -0
  383. package/examples/spa/package.json +12 -0
  384. package/examples/spa/pages/about.vue +18 -0
  385. package/examples/spa/pages/index.vue +8 -0
  386. package/examples/spa/static/favicon.ico +0 -0
  387. package/examples/static-images/README.md +3 -0
  388. package/examples/static-images/package.json +12 -0
  389. package/examples/static-images/pages/about.vue +40 -0
  390. package/examples/static-images/pages/index.vue +19 -0
  391. package/examples/static-images/static/nuxt-black.png +0 -0
  392. package/examples/static-images/static/nuxt.png +0 -0
  393. package/examples/storybook/.storybook/addons.js +5 -0
  394. package/examples/storybook/.storybook/config.js +21 -0
  395. package/examples/storybook/.storybook/webpack.config.js +14 -0
  396. package/examples/storybook/README.md +44 -0
  397. package/examples/storybook/components/Button.vue +36 -0
  398. package/examples/storybook/components/Layout.vue +92 -0
  399. package/examples/storybook/components/LineChart.js +9 -0
  400. package/examples/storybook/components/Logo.vue +79 -0
  401. package/examples/storybook/components/VuetifyLogo.vue +16 -0
  402. package/examples/storybook/components/Welcome.vue +124 -0
  403. package/examples/storybook/layouts/default.vue +102 -0
  404. package/examples/storybook/nuxt.config.js +40 -0
  405. package/examples/storybook/package.json +35 -0
  406. package/examples/storybook/pages/index.vue +63 -0
  407. package/examples/storybook/pages/inspire.vue +15 -0
  408. package/examples/storybook/plugins/vuetify.js +15 -0
  409. package/examples/storybook/static/favicon.ico +0 -0
  410. package/examples/storybook/static/v.png +0 -0
  411. package/examples/storybook/store/README.md +10 -0
  412. package/examples/storybook/stories/LineChart.story.js +92 -0
  413. package/examples/storybook/stories/Logo.story.js +45 -0
  414. package/examples/storybook/stories/MyButton.story.js +14 -0
  415. package/examples/storybook/stories/Welcome.story.js +14 -0
  416. package/examples/storybook/stories/collection.story.js +227 -0
  417. package/examples/storybook/stories/storybase.js +82 -0
  418. package/examples/storybook/stories/vuetify.story.js +110 -0
  419. package/examples/style-resources/README.md +56 -0
  420. package/examples/style-resources/assets/resources.less +1 -0
  421. package/examples/style-resources/assets/variables.scss +1 -0
  422. package/examples/style-resources/nuxt.config.js +9 -0
  423. package/examples/style-resources/package.json +18 -0
  424. package/examples/style-resources/pages/index.vue +18 -0
  425. package/examples/style-resources/pages/less.vue +21 -0
  426. package/examples/styled-vue/README.md +5 -0
  427. package/examples/styled-vue/nuxt.config.js +5 -0
  428. package/examples/styled-vue/package.json +16 -0
  429. package/examples/styled-vue/pages/index.vue +35 -0
  430. package/examples/tailwindcss/README.md +5 -0
  431. package/examples/tailwindcss/assets/css/tailwind.css +57 -0
  432. package/examples/tailwindcss/layouts/default.vue +14 -0
  433. package/examples/tailwindcss/nuxt.config.js +3 -0
  434. package/examples/tailwindcss/package.json +17 -0
  435. package/examples/tailwindcss/pages/about.vue +21 -0
  436. package/examples/tailwindcss/pages/index.vue +29 -0
  437. package/examples/tailwindcss/postcss.config.js +6 -0
  438. package/examples/tailwindcss/tailwind.js +744 -0
  439. package/examples/tailwindcss-purgecss/.github/demo.png +0 -0
  440. package/examples/tailwindcss-purgecss/.github/pagespeed-desktop.png +0 -0
  441. package/examples/tailwindcss-purgecss/.github/pagespeed-mobile.png +0 -0
  442. package/examples/tailwindcss-purgecss/.github/tailwind-default.png +0 -0
  443. package/examples/tailwindcss-purgecss/.github/tailwind-purgecss.png +0 -0
  444. package/examples/tailwindcss-purgecss/README.md +27 -0
  445. package/examples/tailwindcss-purgecss/assets/css/tailwind.css +63 -0
  446. package/examples/tailwindcss-purgecss/components/MyComponent.vue +7 -0
  447. package/examples/tailwindcss-purgecss/layouts/default.vue +8 -0
  448. package/examples/tailwindcss-purgecss/nuxt.config.js +25 -0
  449. package/examples/tailwindcss-purgecss/package.json +25 -0
  450. package/examples/tailwindcss-purgecss/pages/index.vue +21 -0
  451. package/examples/tailwindcss-purgecss/tailwind.config.js +20 -0
  452. package/examples/uikit/README.md +7 -0
  453. package/examples/uikit/layouts/default.vue +5 -0
  454. package/examples/uikit/nuxt.config.js +6 -0
  455. package/examples/uikit/package.json +14 -0
  456. package/examples/uikit/pages/about.vue +21 -0
  457. package/examples/uikit/pages/index.vue +22 -0
  458. package/examples/uikit/plugins/uikit.js +5 -0
  459. package/examples/vue-apollo/README.md +9 -0
  460. package/examples/vue-apollo/apollo/queries/allCars.gql +8 -0
  461. package/examples/vue-apollo/apollo/queries/car.gql +8 -0
  462. package/examples/vue-apollo/nuxt.config.js +10 -0
  463. package/examples/vue-apollo/package.json +16 -0
  464. package/examples/vue-apollo/pages/car/_id.vue +49 -0
  465. package/examples/vue-apollo/pages/index.vue +44 -0
  466. package/examples/vue-chartjs/README.md +7 -0
  467. package/examples/vue-chartjs/components/bar-chart.js +9 -0
  468. package/examples/vue-chartjs/components/doughnut-chart.js +9 -0
  469. package/examples/vue-chartjs/layouts/default.vue +62 -0
  470. package/examples/vue-chartjs/nuxt.config.js +16 -0
  471. package/examples/vue-chartjs/package.json +16 -0
  472. package/examples/vue-chartjs/pages/contributors.vue +57 -0
  473. package/examples/vue-chartjs/pages/index.vue +44 -0
  474. package/examples/vue-class-component/README.md +3 -0
  475. package/examples/vue-class-component/components/Base.vue +49 -0
  476. package/examples/vue-class-component/components/Child.vue +30 -0
  477. package/examples/vue-class-component/package.json +13 -0
  478. package/examples/vue-class-component/pages/about.vue +10 -0
  479. package/examples/vue-class-component/pages/index.vue +19 -0
  480. package/examples/vuex-persistedstate/README.md +4 -0
  481. package/examples/vuex-persistedstate/nuxt.config.js +6 -0
  482. package/examples/vuex-persistedstate/package.json +13 -0
  483. package/examples/vuex-persistedstate/pages/index.vue +26 -0
  484. package/examples/vuex-persistedstate/store/index.js +14 -0
  485. package/examples/vuex-store/README.md +7 -0
  486. package/examples/vuex-store/package.json +12 -0
  487. package/examples/vuex-store/pages/about.vue +12 -0
  488. package/examples/vuex-store/pages/index.vue +44 -0
  489. package/examples/vuex-store/pages/todos.vue +45 -0
  490. package/examples/vuex-store/pages/website.vue +35 -0
  491. package/examples/vuex-store/store/articles/comments/mutations.js +5 -0
  492. package/examples/vuex-store/store/articles/comments.js +13 -0
  493. package/examples/vuex-store/store/articles.js +19 -0
  494. package/examples/vuex-store/store/index.js +9 -0
  495. package/examples/vuex-store/store/todos/getters.js +5 -0
  496. package/examples/vuex-store/store/todos/mutations.js +12 -0
  497. package/examples/vuex-store/store/todos/state.js +3 -0
  498. package/examples/web-worker/.eslintrc.js +19 -0
  499. package/examples/web-worker/README.md +26 -0
  500. package/examples/web-worker/assets/README.md +8 -0
  501. package/examples/web-worker/assets/js/Example.worker.js +19 -0
  502. package/examples/web-worker/components/AppLogo.vue +79 -0
  503. package/examples/web-worker/components/README.md +6 -0
  504. package/examples/web-worker/layouts/README.md +8 -0
  505. package/examples/web-worker/layouts/default.vue +58 -0
  506. package/examples/web-worker/nuxt.config.js +52 -0
  507. package/examples/web-worker/package.json +24 -0
  508. package/examples/web-worker/pages/README.md +7 -0
  509. package/examples/web-worker/pages/index.vue +185 -0
  510. package/examples/web-worker/plugins/README.md +8 -0
  511. package/examples/web-worker/plugins/inject-ww.js +9 -0
  512. package/examples/web-worker/static/README.md +11 -0
  513. package/examples/web-worker/static/favicon.ico +0 -0
  514. package/examples/with-amp/README.md +3 -0
  515. package/examples/with-amp/app.html +11 -0
  516. package/examples/with-amp/assets/main.css +23 -0
  517. package/examples/with-amp/components/Byline.vue +16 -0
  518. package/examples/with-amp/nuxt.config.js +39 -0
  519. package/examples/with-amp/package.json +14 -0
  520. package/examples/with-amp/pages/dog.vue +36 -0
  521. package/examples/with-amp/pages/index.vue +36 -0
  522. package/examples/with-amp/static/cat.jpg +0 -0
  523. package/examples/with-amp/static/dog.jpg +0 -0
  524. package/examples/with-ava/Readme.md +7 -0
  525. package/examples/with-ava/package.json +17 -0
  526. package/examples/with-ava/pages/index.vue +19 -0
  527. package/examples/with-ava/test/index.test.js +43 -0
  528. package/examples/with-buefy/README.md +3 -0
  529. package/examples/with-buefy/components/card.vue +42 -0
  530. package/examples/with-buefy/nuxt.config.js +12 -0
  531. package/examples/with-buefy/package.json +16 -0
  532. package/examples/with-buefy/pages/index.vue +43 -0
  533. package/examples/with-cookies/README.md +5 -0
  534. package/examples/with-cookies/nuxt.config.js +9 -0
  535. package/examples/with-cookies/package.json +14 -0
  536. package/examples/with-cookies/pages/index.vue +85 -0
  537. package/examples/with-cookies/plugins/cookies.js +34 -0
  538. package/examples/with-element-ui/README.md +3 -0
  539. package/examples/with-element-ui/layouts/default.vue +10 -0
  540. package/examples/with-element-ui/nuxt.config.js +15 -0
  541. package/examples/with-element-ui/package.json +19 -0
  542. package/examples/with-element-ui/pages/index.vue +108 -0
  543. package/examples/with-element-ui/plugins/element-ui.js +7 -0
  544. package/examples/with-feathers/.editorconfig +13 -0
  545. package/examples/with-feathers/.eslintrc.js +42 -0
  546. package/examples/with-feathers/.jshintrc +29 -0
  547. package/examples/with-feathers/LICENSE +22 -0
  548. package/examples/with-feathers/README.md +50 -0
  549. package/examples/with-feathers/config/default.json +11 -0
  550. package/examples/with-feathers/config/production.json +11 -0
  551. package/examples/with-feathers/nuxt.config.js +5 -0
  552. package/examples/with-feathers/package.json +47 -0
  553. package/examples/with-feathers/pages/about.vue +18 -0
  554. package/examples/with-feathers/pages/index.vue +8 -0
  555. package/examples/with-feathers/src/app.js +28 -0
  556. package/examples/with-feathers/src/hooks/index.js +11 -0
  557. package/examples/with-feathers/src/index.js +14 -0
  558. package/examples/with-feathers/src/middleware/index.js +10 -0
  559. package/examples/with-feathers/src/middleware/nuxt.js +23 -0
  560. package/examples/with-feathers/src/services/authentication/index.js +9 -0
  561. package/examples/with-feathers/src/services/index.js +9 -0
  562. package/examples/with-feathers/src/services/user/hooks/index.js +50 -0
  563. package/examples/with-feathers/src/services/user/index.js +33 -0
  564. package/examples/with-feathers/static/favicon.ico +0 -0
  565. package/examples/with-feathers/test/app.test.js +36 -0
  566. package/examples/with-feathers/test/services/user/index.test.js +8 -0
  567. package/examples/with-firebase/README.md +29 -0
  568. package/examples/with-firebase/layouts/default.vue +29 -0
  569. package/examples/with-firebase/nuxt.config.js +11 -0
  570. package/examples/with-firebase/package.json +21 -0
  571. package/examples/with-firebase/pages/index.vue +41 -0
  572. package/examples/with-firebase/pages/users/_key.vue +31 -0
  573. package/examples/with-firebase/plugins/axios.js +5 -0
  574. package/examples/with-keep-alive/README.md +15 -0
  575. package/examples/with-keep-alive/layouts/default.vue +3 -0
  576. package/examples/with-keep-alive/package.json +12 -0
  577. package/examples/with-keep-alive/pages/about.vue +21 -0
  578. package/examples/with-keep-alive/pages/index.vue +16 -0
  579. package/examples/with-museui/README.md +3 -0
  580. package/examples/with-museui/nuxt.config.js +26 -0
  581. package/examples/with-museui/package.json +13 -0
  582. package/examples/with-museui/pages/index.vue +43 -0
  583. package/examples/with-museui/plugins/museui.js +4 -0
  584. package/examples/with-purgecss/README.md +6 -0
  585. package/examples/with-purgecss/assets/css/tailwind.css +57 -0
  586. package/examples/with-purgecss/layouts/default.vue +14 -0
  587. package/examples/with-purgecss/nuxt.config.js +44 -0
  588. package/examples/with-purgecss/package.json +18 -0
  589. package/examples/with-purgecss/pages/about.vue +21 -0
  590. package/examples/with-purgecss/pages/index.vue +29 -0
  591. package/examples/with-purgecss/tailwind.js +744 -0
  592. package/examples/with-sockets/README.md +12 -0
  593. package/examples/with-sockets/io/index.js +26 -0
  594. package/examples/with-sockets/nuxt.config.js +12 -0
  595. package/examples/with-sockets/package.json +18 -0
  596. package/examples/with-sockets/pages/index.vue +157 -0
  597. package/examples/with-sockets/plugins/socket.io.js +4 -0
  598. package/examples/with-sockets/server.js +36 -0
  599. package/examples/with-tape/README.md +3 -0
  600. package/examples/with-tape/package.json +22 -0
  601. package/examples/with-tape/pages/index.vue +35 -0
  602. package/examples/with-tape/test/index.test.js +43 -0
  603. package/examples/with-tape/test/setup.js +14 -0
  604. package/examples/with-vue-material/README.md +9 -0
  605. package/examples/with-vue-material/nuxt.config.js +25 -0
  606. package/examples/with-vue-material/package.json +15 -0
  607. package/examples/with-vue-material/pages/index.vue +132 -0
  608. package/examples/with-vue-material/plugins/vue-material.js +4 -0
  609. package/examples/with-vuetify/README.md +11 -0
  610. package/examples/with-vuetify/assets/variabales.scss +1 -0
  611. package/examples/with-vuetify/layouts/default.vue +103 -0
  612. package/examples/with-vuetify/nuxt.config.js +25 -0
  613. package/examples/with-vuetify/package.json +16 -0
  614. package/examples/with-vuetify/pages/about.vue +18 -0
  615. package/examples/with-vuetify/pages/index.vue +11 -0
  616. package/examples/with-vuetify/vuetify.options.js +13 -0
  617. package/examples/with-vuikit/README.md +3 -0
  618. package/examples/with-vuikit/layouts/default.vue +5 -0
  619. package/examples/with-vuikit/nuxt.config.js +6 -0
  620. package/examples/with-vuikit/package.json +15 -0
  621. package/examples/with-vuikit/pages/index.vue +19 -0
  622. package/examples/with-vuikit/plugins/vuikit.js +6 -0
  623. package/examples/with-vux/README.md +3 -0
  624. package/examples/with-vux/layouts/default.vue +9 -0
  625. package/examples/with-vux/nuxt.config.js +40 -0
  626. package/examples/with-vux/package.json +20 -0
  627. package/examples/with-vux/pages/index.vue +22 -0
  628. package/examples/with-vux/plugins/vux-components.js +5 -0
  629. package/examples/with-vux/plugins/vux-plugins.js +12 -0
  630. package/examples/with-vux/styles/theme.less +1 -0
  631. package/jest.config.js +61 -0
  632. package/lerna.json +28 -0
  633. package/package.json +66 -0
  634. package/packages/babel-preset-app/README.md +120 -0
  635. package/packages/babel-preset-app/package.json +33 -0
  636. package/packages/babel-preset-app/src/index.js +187 -0
  637. package/packages/babel-preset-app/src/polyfills-plugin.js +37 -0
  638. package/packages/builder/package.js +7 -0
  639. package/packages/builder/package.json +30 -0
  640. package/packages/builder/src/builder.js +795 -0
  641. package/packages/builder/src/context/build.js +16 -0
  642. package/packages/builder/src/context/template.js +82 -0
  643. package/packages/builder/src/ignore.js +59 -0
  644. package/packages/builder/src/index.js +10 -0
  645. package/packages/builder/test/__utils__/index.js +24 -0
  646. package/packages/builder/test/builder.build.test.js +209 -0
  647. package/packages/builder/test/builder.common.test.js +59 -0
  648. package/packages/builder/test/builder.ctor.test.js +116 -0
  649. package/packages/builder/test/builder.generate.test.js +710 -0
  650. package/packages/builder/test/builder.plugin.test.js +189 -0
  651. package/packages/builder/test/builder.watch.test.js +435 -0
  652. package/packages/builder/test/context/__snapshots__/template.test.js.snap +117 -0
  653. package/packages/builder/test/context/build.test.js +38 -0
  654. package/packages/builder/test/context/template.test.js +87 -0
  655. package/packages/builder/test/ignore.test.js +147 -0
  656. package/packages/builder/test/index.test.js +9 -0
  657. package/packages/cli/bin/nuxt-cli.js +7 -0
  658. package/packages/cli/package.js +5 -0
  659. package/packages/cli/package.json +43 -0
  660. package/packages/cli/src/command.js +239 -0
  661. package/packages/cli/src/commands/build.js +92 -0
  662. package/packages/cli/src/commands/dev.js +116 -0
  663. package/packages/cli/src/commands/export.js +10 -0
  664. package/packages/cli/src/commands/generate.js +121 -0
  665. package/packages/cli/src/commands/help.js +29 -0
  666. package/packages/cli/src/commands/index.js +17 -0
  667. package/packages/cli/src/commands/serve.js +10 -0
  668. package/packages/cli/src/commands/start.js +27 -0
  669. package/packages/cli/src/commands/webpack.js +116 -0
  670. package/packages/cli/src/imports.js +18 -0
  671. package/packages/cli/src/index.js +16 -0
  672. package/packages/cli/src/list.js +35 -0
  673. package/packages/cli/src/options/common.js +68 -0
  674. package/packages/cli/src/options/index.js +9 -0
  675. package/packages/cli/src/options/locking.js +7 -0
  676. package/packages/cli/src/options/server.js +29 -0
  677. package/packages/cli/src/run.js +56 -0
  678. package/packages/cli/src/setup.js +41 -0
  679. package/packages/cli/src/utils/banner.js +60 -0
  680. package/packages/cli/src/utils/config.js +34 -0
  681. package/packages/cli/src/utils/constants.js +8 -0
  682. package/packages/cli/src/utils/dependencies.js +35 -0
  683. package/packages/cli/src/utils/dir.js +11 -0
  684. package/packages/cli/src/utils/formatting.js +69 -0
  685. package/packages/cli/src/utils/generate.js +185 -0
  686. package/packages/cli/src/utils/index.js +64 -0
  687. package/packages/cli/src/utils/memory.js +18 -0
  688. package/packages/cli/src/utils/serve.js +78 -0
  689. package/packages/cli/src/utils/webpack.js +11 -0
  690. package/packages/cli/test/fixtures/nuxt.async-config.js +9 -0
  691. package/packages/cli/test/fixtures/nuxt.async-error.js +1 -0
  692. package/packages/cli/test/fixtures/nuxt.config.js +10 -0
  693. package/packages/cli/test/fixtures/nuxt.fn-config.js +3 -0
  694. package/packages/cli/test/unit/__snapshots__/command.test.js.snap +46 -0
  695. package/packages/cli/test/unit/__snapshots__/webpack.test.js.snap +726 -0
  696. package/packages/cli/test/unit/build.test.js +148 -0
  697. package/packages/cli/test/unit/cli.test.js +47 -0
  698. package/packages/cli/test/unit/command.test.js +173 -0
  699. package/packages/cli/test/unit/dependencies.test.js +24 -0
  700. package/packages/cli/test/unit/dev.test.js +141 -0
  701. package/packages/cli/test/unit/export.test.js +118 -0
  702. package/packages/cli/test/unit/generate.test.js +162 -0
  703. package/packages/cli/test/unit/hooks.test.js +52 -0
  704. package/packages/cli/test/unit/imports.test.js +19 -0
  705. package/packages/cli/test/unit/list.test.js +57 -0
  706. package/packages/cli/test/unit/run-edge.test.js +18 -0
  707. package/packages/cli/test/unit/run.test.js +75 -0
  708. package/packages/cli/test/unit/serve.test.js +38 -0
  709. package/packages/cli/test/unit/start.test.js +68 -0
  710. package/packages/cli/test/unit/utils-minimalcli.test.js +33 -0
  711. package/packages/cli/test/unit/utils.test.js +273 -0
  712. package/packages/cli/test/unit/webpack.test.js +50 -0
  713. package/packages/cli/test/utils/index.js +14 -0
  714. package/packages/cli/test/utils/mocking.js +121 -0
  715. package/packages/config/index.d.ts +3 -0
  716. package/packages/config/package.js +3 -0
  717. package/packages/config/package.json +26 -0
  718. package/packages/config/src/config/_app.js +75 -0
  719. package/packages/config/src/config/_common.js +93 -0
  720. package/packages/config/src/config/build.js +136 -0
  721. package/packages/config/src/config/cli.js +4 -0
  722. package/packages/config/src/config/generate.js +23 -0
  723. package/packages/config/src/config/index.js +33 -0
  724. package/packages/config/src/config/messages.js +12 -0
  725. package/packages/config/src/config/modes.js +20 -0
  726. package/packages/config/src/config/render.js +45 -0
  727. package/packages/config/src/config/router.js +18 -0
  728. package/packages/config/src/config/server.js +14 -0
  729. package/packages/config/src/index.js +3 -0
  730. package/packages/config/src/load.js +189 -0
  731. package/packages/config/src/options.js +529 -0
  732. package/packages/config/test/__snapshots__/options.test.js.snap +432 -0
  733. package/packages/config/test/config/__snapshots__/index.test.js.snap +777 -0
  734. package/packages/config/test/config/_common.test.js +14 -0
  735. package/packages/config/test/config/build.test.js +32 -0
  736. package/packages/config/test/config/index.test.js +28 -0
  737. package/packages/config/test/config/render.test.js +19 -0
  738. package/packages/config/test/config/server.test.js +45 -0
  739. package/packages/config/test/fixtures/app.html +0 -0
  740. package/packages/config/test/fixtures/nuxtrc/.nuxtrc +1 -0
  741. package/packages/config/test/fixtures/store/index.js +0 -0
  742. package/packages/config/test/index.test.js +16 -0
  743. package/packages/config/test/load.test.js +10 -0
  744. package/packages/config/test/options.test.js +329 -0
  745. package/packages/core/package.js +3 -0
  746. package/packages/core/package.json +23 -0
  747. package/packages/core/src/index.js +5 -0
  748. package/packages/core/src/load.js +40 -0
  749. package/packages/core/src/module.js +219 -0
  750. package/packages/core/src/nuxt.js +125 -0
  751. package/packages/core/src/resolver.js +165 -0
  752. package/packages/core/test/__modules__/__resolver__.js +0 -0
  753. package/packages/core/test/index.test.js +17 -0
  754. package/packages/core/test/module.test.js +477 -0
  755. package/packages/core/test/nuxt.test.js +179 -0
  756. package/packages/core/test/resolver.test.js +424 -0
  757. package/packages/generator/package.js +3 -0
  758. package/packages/generator/package.json +24 -0
  759. package/packages/generator/src/generator.js +443 -0
  760. package/packages/generator/src/index.js +6 -0
  761. package/packages/generator/test/__utils__/index.js +27 -0
  762. package/packages/generator/test/generator.gen.test.js +201 -0
  763. package/packages/generator/test/generator.init.test.js +234 -0
  764. package/packages/generator/test/generator.route.test.js +245 -0
  765. package/packages/generator/test/index.test.js +11 -0
  766. package/packages/server/package.js +4 -0
  767. package/packages/server/package.json +32 -0
  768. package/packages/server/src/context.js +8 -0
  769. package/packages/server/src/index.js +2 -0
  770. package/packages/server/src/jsdom.js +75 -0
  771. package/packages/server/src/listener.js +120 -0
  772. package/packages/server/src/middleware/error.js +129 -0
  773. package/packages/server/src/middleware/nuxt.js +156 -0
  774. package/packages/server/src/middleware/timing.js +56 -0
  775. package/packages/server/src/server.js +427 -0
  776. package/packages/server/test/contest.test.js +17 -0
  777. package/packages/server/test/index.test.js +14 -0
  778. package/packages/server/test/listener.test.js +428 -0
  779. package/packages/server/test/middleware/error.test.js +221 -0
  780. package/packages/server/test/middleware/nuxt.test.js +352 -0
  781. package/packages/server/test/middleware/timing.test.js +103 -0
  782. package/packages/server/test/server.test.js +546 -0
  783. package/packages/types/README.md +8 -0
  784. package/packages/types/app/index.d.ts +179 -0
  785. package/packages/types/app/vue.d.ts +44 -0
  786. package/packages/types/app/vuex.d.ts +10 -0
  787. package/packages/types/cli/index.d.ts +8 -0
  788. package/packages/types/config/build.d.ts +185 -0
  789. package/packages/types/config/cli.d.ts +14 -0
  790. package/packages/types/config/env.d.ts +6 -0
  791. package/packages/types/config/features.d.ts +19 -0
  792. package/packages/types/config/fetch.d.ts +9 -0
  793. package/packages/types/config/generate.d.ts +28 -0
  794. package/packages/types/config/globals.d.ts +7 -0
  795. package/packages/types/config/head.d.ts +9 -0
  796. package/packages/types/config/hooks.d.ts +53 -0
  797. package/packages/types/config/index.d.ts +77 -0
  798. package/packages/types/config/loading.d.ts +27 -0
  799. package/packages/types/config/module.d.ts +31 -0
  800. package/packages/types/config/plugin.d.ts +7 -0
  801. package/packages/types/config/render.d.ts +76 -0
  802. package/packages/types/config/router.d.ts +27 -0
  803. package/packages/types/config/runtime.d.ts +15 -0
  804. package/packages/types/config/server-middleware.d.ts +10 -0
  805. package/packages/types/config/server.d.ts +15 -0
  806. package/packages/types/config/vue-configuration.d.ts +9 -0
  807. package/packages/types/config/watchers.d.ts +14 -0
  808. package/packages/types/index.d.ts +11 -0
  809. package/packages/types/index.js +1 -0
  810. package/packages/types/package.js +3 -0
  811. package/packages/types/package.json +37 -0
  812. package/packages/types/process.d.ts +14 -0
  813. package/packages/types/test/index.ts +2 -0
  814. package/packages/types/test/process.ts +17 -0
  815. package/packages/types/test/tsconfig.json +13 -0
  816. package/packages/types/test/vue.ts +112 -0
  817. package/packages/utils/package.js +3 -0
  818. package/packages/utils/package.json +27 -0
  819. package/packages/utils/src/cjs.js +98 -0
  820. package/packages/utils/src/constants.js +9 -0
  821. package/packages/utils/src/context.js +21 -0
  822. package/packages/utils/src/index.js +11 -0
  823. package/packages/utils/src/lang.js +40 -0
  824. package/packages/utils/src/locking.js +102 -0
  825. package/packages/utils/src/modern.js +61 -0
  826. package/packages/utils/src/resolve.js +110 -0
  827. package/packages/utils/src/route.js +280 -0
  828. package/packages/utils/src/serialize.js +52 -0
  829. package/packages/utils/src/task.js +40 -0
  830. package/packages/utils/src/timer.js +65 -0
  831. package/packages/utils/test/__snapshots__/route.test.js.snap +261 -0
  832. package/packages/utils/test/cjs.test.js +14 -0
  833. package/packages/utils/test/context.test.js +24 -0
  834. package/packages/utils/test/index.test.js +30 -0
  835. package/packages/utils/test/lang.test.js +55 -0
  836. package/packages/utils/test/locking.test.js +223 -0
  837. package/packages/utils/test/modern.test.js +60 -0
  838. package/packages/utils/test/resolve.posix.test.js +85 -0
  839. package/packages/utils/test/resolve.win.test.js +90 -0
  840. package/packages/utils/test/route.test.js +240 -0
  841. package/packages/utils/test/serialize.test.input.js +41 -0
  842. package/packages/utils/test/serialize.test.js +69 -0
  843. package/packages/utils/test/task.test.js +117 -0
  844. package/packages/utils/test/timer.test.js +165 -0
  845. package/packages/vue-app/index.d.ts +3 -0
  846. package/packages/vue-app/package.js +16 -0
  847. package/packages/vue-app/package.json +31 -0
  848. package/packages/vue-app/src/index.js +28 -0
  849. package/packages/vue-app/template/.eslintignore +3 -0
  850. package/packages/vue-app/template/App.js +347 -0
  851. package/packages/vue-app/template/client.js +951 -0
  852. package/packages/vue-app/template/components/nuxt-build-indicator.vue +143 -0
  853. package/packages/vue-app/template/components/nuxt-child.js +128 -0
  854. package/packages/vue-app/template/components/nuxt-error.vue +99 -0
  855. package/packages/vue-app/template/components/nuxt-link.client.js +128 -0
  856. package/packages/vue-app/template/components/nuxt-link.server.js +17 -0
  857. package/packages/vue-app/template/components/nuxt-loading.vue +177 -0
  858. package/packages/vue-app/template/components/nuxt.js +109 -0
  859. package/packages/vue-app/template/empty.js +1 -0
  860. package/packages/vue-app/template/index.js +298 -0
  861. package/packages/vue-app/template/jsonp.js +83 -0
  862. package/packages/vue-app/template/layouts/default.vue +3 -0
  863. package/packages/vue-app/template/middleware.js +12 -0
  864. package/packages/vue-app/template/mixins/fetch.client.js +134 -0
  865. package/packages/vue-app/template/mixins/fetch.server.js +70 -0
  866. package/packages/vue-app/template/pages/index.vue +108 -0
  867. package/packages/vue-app/template/router.js +123 -0
  868. package/packages/vue-app/template/router.scrollBehavior.js +82 -0
  869. package/packages/vue-app/template/routes.json +1 -0
  870. package/packages/vue-app/template/server.js +351 -0
  871. package/packages/vue-app/template/store.js +158 -0
  872. package/packages/vue-app/template/utils.js +639 -0
  873. package/packages/vue-app/template/views/app.template.html +9 -0
  874. package/packages/vue-app/template/views/error.html +23 -0
  875. package/packages/vue-app/template/views/loading/chasing-dots.html +67 -0
  876. package/packages/vue-app/template/views/loading/circle.html +150 -0
  877. package/packages/vue-app/template/views/loading/cube-grid.html +87 -0
  878. package/packages/vue-app/template/views/loading/default.html +110 -0
  879. package/packages/vue-app/template/views/loading/fading-circle.html +164 -0
  880. package/packages/vue-app/template/views/loading/folding-cube.html +108 -0
  881. package/packages/vue-app/template/views/loading/nuxt.html +59 -0
  882. package/packages/vue-app/template/views/loading/pulse.html +48 -0
  883. package/packages/vue-app/template/views/loading/rectangle-bounce.html +74 -0
  884. package/packages/vue-app/template/views/loading/rotating-plane.html +44 -0
  885. package/packages/vue-app/template/views/loading/three-bounce.html +61 -0
  886. package/packages/vue-app/template/views/loading/wandering-cubes.html +68 -0
  887. package/packages/vue-app/test/__utils__/index.js +73 -0
  888. package/packages/vue-app/test/nuxt-link.client.prefetch.test.js +153 -0
  889. package/packages/vue-app/test/nuxt-loading.test.js +189 -0
  890. package/packages/vue-app/vetur/nuxt-attributes.json +38 -0
  891. package/packages/vue-app/vetur/nuxt-tags.json +47 -0
  892. package/packages/vue-app/web-types/web-types.json +251 -0
  893. package/packages/vue-renderer/package.js +3 -0
  894. package/packages/vue-renderer/package.json +26 -0
  895. package/packages/vue-renderer/src/index.js +1 -0
  896. package/packages/vue-renderer/src/renderer.js +390 -0
  897. package/packages/vue-renderer/src/renderers/base.js +25 -0
  898. package/packages/vue-renderer/src/renderers/modern.js +124 -0
  899. package/packages/vue-renderer/src/renderers/spa.js +214 -0
  900. package/packages/vue-renderer/src/renderers/ssr.js +307 -0
  901. package/packages/webpack/package.js +21 -0
  902. package/packages/webpack/package.json +60 -0
  903. package/packages/webpack/src/builder.js +257 -0
  904. package/packages/webpack/src/config/base.js +538 -0
  905. package/packages/webpack/src/config/client.js +221 -0
  906. package/packages/webpack/src/config/index.js +3 -0
  907. package/packages/webpack/src/config/modern.js +15 -0
  908. package/packages/webpack/src/config/server.js +147 -0
  909. package/packages/webpack/src/index.js +1 -0
  910. package/packages/webpack/src/plugins/vue/client.js +111 -0
  911. package/packages/webpack/src/plugins/vue/cors.js +25 -0
  912. package/packages/webpack/src/plugins/vue/modern.js +121 -0
  913. package/packages/webpack/src/plugins/vue/server.js +71 -0
  914. package/packages/webpack/src/plugins/vue/util.js +31 -0
  915. package/packages/webpack/src/plugins/warning-ignore.js +11 -0
  916. package/packages/webpack/src/utils/async-mfs.js +24 -0
  917. package/packages/webpack/src/utils/index.js +3 -0
  918. package/packages/webpack/src/utils/perf-loader.js +66 -0
  919. package/packages/webpack/src/utils/postcss-v8.js +208 -0
  920. package/packages/webpack/src/utils/postcss.js +193 -0
  921. package/packages/webpack/src/utils/reserved-tags.js +23 -0
  922. package/packages/webpack/src/utils/style-loader.js +157 -0
  923. package/packages/webpack/test/index.test.js +23 -0
  924. package/renovate.json +27 -0
  925. package/scripts/builtins.js +22 -0
  926. package/scripts/changelog.js +154 -0
  927. package/scripts/dev.js +39 -0
  928. package/scripts/link.js +28 -0
  929. package/scripts/package.js +382 -0
  930. package/scripts/pkg.js +55 -0
  931. package/scripts/release-publish +14 -0
  932. package/scripts/release-version +4 -0
  933. package/scripts/rollup.config.js +67 -0
  934. package/scripts/workspace-run +10 -0
  935. package/test/dev/async-config.size-limit.test.js +45 -0
  936. package/test/dev/async-config.test.js +21 -0
  937. package/test/dev/basic.config.defaults.test.js +73 -0
  938. package/test/dev/basic.dev.test.js +204 -0
  939. package/test/dev/basic.dynamic.test.js +77 -0
  940. package/test/dev/basic.fail.generate.test.js +33 -0
  941. package/test/dev/basic.generate.test.js +286 -0
  942. package/test/dev/basic.plugins.test.js +51 -0
  943. package/test/dev/basic.relative.test.js +41 -0
  944. package/test/dev/basic.ssr.csp.test.js +477 -0
  945. package/test/dev/basic.ssr.test.js +426 -0
  946. package/test/dev/children.test.js +56 -0
  947. package/test/dev/cli.test.js +82 -0
  948. package/test/dev/custom-app-template.test.js +57 -0
  949. package/test/dev/custom-dirs.test.js +55 -0
  950. package/test/dev/dist-options.test.js +35 -0
  951. package/test/dev/dynamic-routes.test.js +90 -0
  952. package/test/dev/encoding.test.js +76 -0
  953. package/test/dev/error.test.js +83 -0
  954. package/test/dev/express.test.js +42 -0
  955. package/test/dev/extract-css.test.js +36 -0
  956. package/test/dev/fallback.test.js +44 -0
  957. package/test/dev/filenames-query-part.test.js +55 -0
  958. package/test/dev/full-static.test.js +89 -0
  959. package/test/dev/generator.test.js +86 -0
  960. package/test/dev/https.test.js +24 -0
  961. package/test/dev/modern.client.test.js +53 -0
  962. package/test/dev/modern.server.test.js +79 -0
  963. package/test/dev/modern.spa.test.js +75 -0
  964. package/test/dev/module.test.js +97 -0
  965. package/test/dev/named-views.test.js +43 -0
  966. package/test/dev/nuxt.test.js +66 -0
  967. package/test/dev/renderer.test.js +51 -0
  968. package/test/dev/route-name-splitter.test.js +20 -0
  969. package/test/dev/runtime-config.test.js +45 -0
  970. package/test/dev/server.listen.test.js +79 -0
  971. package/test/dev/sockets.test.js +16 -0
  972. package/test/dev/spa.test.js +174 -0
  973. package/test/dev/ssr.test.js +130 -0
  974. package/test/dev/trailing-slash-payload.test.js +64 -0
  975. package/test/dev/trailing-slash.test.js +92 -0
  976. package/test/dev/with-config.test.js +235 -0
  977. package/test/dev/wp.config.test.js +42 -0
  978. package/test/e2e/basic.browser.test.js +338 -0
  979. package/test/e2e/basic.vue-config.test.js +58 -0
  980. package/test/e2e/children.patch.browser.test.js +166 -0
  981. package/test/e2e/error.test.js +71 -0
  982. package/test/e2e/fetch.browser.test.js +216 -0
  983. package/test/e2e/page-transitions.browser.test.js +112 -0
  984. package/test/e2e/spa-base.browser.test.js +71 -0
  985. package/test/e2e/split-layouts-error.test.js +51 -0
  986. package/test/fixtures/async-config/async-config.test.js +3 -0
  987. package/test/fixtures/async-config/nuxt.config.js +15 -0
  988. package/test/fixtures/async-config/pages/index.vue +3 -0
  989. package/test/fixtures/basic/assets/app.css +1 -0
  990. package/test/fixtures/basic/assets/import.css +1 -0
  991. package/test/fixtures/basic/assets/test.svg +98 -0
  992. package/test/fixtures/basic/basic.test.js +3 -0
  993. package/test/fixtures/basic/components/MyComponent.vue +3 -0
  994. package/test/fixtures/basic/layouts/custom.js +10 -0
  995. package/test/fixtures/basic/layouts/default.vue +5 -0
  996. package/test/fixtures/basic/middleware/-ignored.js +3 -0
  997. package/test/fixtures/basic/middleware/error.js +3 -0
  998. package/test/fixtures/basic/middleware/ignored.test.js +3 -0
  999. package/test/fixtures/basic/middleware/meta.js +3 -0
  1000. package/test/fixtures/basic/middleware/redirect.js +3 -0
  1001. package/test/fixtures/basic/nuxt.config.js +104 -0
  1002. package/test/fixtures/basic/pages/-ignored.vue +13 -0
  1003. package/test/fixtures/basic/pages/async-data.vue +13 -0
  1004. package/test/fixtures/basic/pages/await-async-data.vue +18 -0
  1005. package/test/fixtures/basic/pages/callback-async-data.vue +13 -0
  1006. package/test/fixtures/basic/pages/client-only.vue +7 -0
  1007. package/test/fixtures/basic/pages/components.vue +5 -0
  1008. package/test/fixtures/basic/pages/config.vue +29 -0
  1009. package/test/fixtures/basic/pages/css.vue +15 -0
  1010. package/test/fixtures/basic/pages/custom.js +6 -0
  1011. package/test/fixtures/basic/pages/error-midd.vue +13 -0
  1012. package/test/fixtures/basic/pages/error-object.vue +8 -0
  1013. package/test/fixtures/basic/pages/error-string.vue +8 -0
  1014. package/test/fixtures/basic/pages/error.vue +11 -0
  1015. package/test/fixtures/basic/pages/error2.vue +11 -0
  1016. package/test/fixtures/basic/pages/extractCSS.vue +9 -0
  1017. package/test/fixtures/basic/pages/fetch.vue +50 -0
  1018. package/test/fixtures/basic/pages/fn-midd.vue +17 -0
  1019. package/test/fixtures/basic/pages/head.vue +28 -0
  1020. package/test/fixtures/basic/pages/ignored.test.vue +13 -0
  1021. package/test/fixtures/basic/pages/index.vue +6 -0
  1022. package/test/fixtures/basic/pages/js-link.js +2 -0
  1023. package/test/fixtures/basic/pages/js-link.vue +5 -0
  1024. package/test/fixtures/basic/pages/jsx-link.js +5 -0
  1025. package/test/fixtures/basic/pages/jsx-link2.jsx +5 -0
  1026. package/test/fixtures/basic/pages/jsx.js +7 -0
  1027. package/test/fixtures/basic/pages/meta.vue +12 -0
  1028. package/test/fixtures/basic/pages/no-ssr.vue +7 -0
  1029. package/test/fixtures/basic/pages/noloading.vue +27 -0
  1030. package/test/fixtures/basic/pages/postcss.vue +15 -0
  1031. package/test/fixtures/basic/pages/redirect-external-no-slash.vue +11 -0
  1032. package/test/fixtures/basic/pages/redirect-external-root.vue +11 -0
  1033. package/test/fixtures/basic/pages/redirect-external.vue +11 -0
  1034. package/test/fixtures/basic/pages/redirect-middleware.vue +8 -0
  1035. package/test/fixtures/basic/pages/redirect-name.vue +11 -0
  1036. package/test/fixtures/basic/pages/redirect.vue +11 -0
  1037. package/test/fixtures/basic/pages/redirection/_slug.vue +18 -0
  1038. package/test/fixtures/basic/pages/refresh-page-data.vue +15 -0
  1039. package/test/fixtures/basic/pages/router-guard-error.vue +3 -0
  1040. package/test/fixtures/basic/pages/router-guard.vue +11 -0
  1041. package/test/fixtures/basic/pages/scroll-to-top/index.vue +24 -0
  1042. package/test/fixtures/basic/pages/scroll-to-top/scroll-to-top-false.vue +13 -0
  1043. package/test/fixtures/basic/pages/scroll-to-top/scroll-to-top-true.vue +13 -0
  1044. package/test/fixtures/basic/pages/scroll-to-top/watch-query-array.vue +19 -0
  1045. package/test/fixtures/basic/pages/scroll-to-top/watch-query-fn.vue +24 -0
  1046. package/test/fixtures/basic/pages/scroll-to-top/watch-query-true.vue +19 -0
  1047. package/test/fixtures/basic/pages/skip-on-fail/fail.vue +11 -0
  1048. package/test/fixtures/basic/pages/skip-on-fail/success.vue +8 -0
  1049. package/test/fixtures/basic/pages/special-state.vue +15 -0
  1050. package/test/fixtures/basic/pages/stateful.vue +16 -0
  1051. package/test/fixtures/basic/pages/stateless.vue +3 -0
  1052. package/test/fixtures/basic/pages/store-module.vue +11 -0
  1053. package/test/fixtures/basic/pages/store.vue +27 -0
  1054. package/test/fixtures/basic/pages/style.vue +18 -0
  1055. package/test/fixtures/basic/pages/symlink/deep/nested-symlinked.vue +3 -0
  1056. package/test/fixtures/basic/pages/symlink/symlinked.vue +3 -0
  1057. package/test/fixtures/basic/pages/users/_id.vue +12 -0
  1058. package/test/fixtures/basic/pages/validate-async.vue +21 -0
  1059. package/test/fixtures/basic/pages/validate.vue +17 -0
  1060. package/test/fixtures/basic/pages//321/202/320/265/321/201/321/202/351/233/250.vue +3 -0
  1061. package/test/fixtures/basic/pages2/deep/nested-symlinked.vue +3 -0
  1062. package/test/fixtures/basic/pages2/symlinked.vue +3 -0
  1063. package/test/fixtures/basic/plugins/dir-plugin/index.js +3 -0
  1064. package/test/fixtures/basic/plugins/inject.js +17 -0
  1065. package/test/fixtures/basic/plugins/router-guard.js +17 -0
  1066. package/test/fixtures/basic/plugins/tailwind.js +6 -0
  1067. package/test/fixtures/basic/plugins/vuex-module.js +27 -0
  1068. package/test/fixtures/basic/static/body.js +2 -0
  1069. package/test/fixtures/basic/store/-ignored.js +1 -0
  1070. package/test/fixtures/basic/store/bab/index.js +9 -0
  1071. package/test/fixtures/basic/store/foo/bar.js +9 -0
  1072. package/test/fixtures/basic/store/foo/blarg/getters.js +5 -0
  1073. package/test/fixtures/basic/store/foo/blarg/index.js +9 -0
  1074. package/test/fixtures/basic/store/foo/blarg/state.js +3 -0
  1075. package/test/fixtures/basic/store/foo/blarg.js +9 -0
  1076. package/test/fixtures/basic/store/ignored.test.js +1 -0
  1077. package/test/fixtures/basic/store/index.js +13 -0
  1078. package/test/fixtures/children/children.test.js +3 -0
  1079. package/test/fixtures/children/layouts/patch.vue +62 -0
  1080. package/test/fixtures/children/pages/parent/_id.vue +20 -0
  1081. package/test/fixtures/children/pages/parent/child.vue +3 -0
  1082. package/test/fixtures/children/pages/parent/validate-child.vue +11 -0
  1083. package/test/fixtures/children/pages/parent.vue +23 -0
  1084. package/test/fixtures/children/pages/patch/_id/child/_slug.vue +62 -0
  1085. package/test/fixtures/children/pages/patch/_id/child.vue +20 -0
  1086. package/test/fixtures/children/pages/patch/_id/index.vue +3 -0
  1087. package/test/fixtures/children/pages/patch/_id/reuse/_slug.vue +20 -0
  1088. package/test/fixtures/children/pages/patch/_id.vue +20 -0
  1089. package/test/fixtures/children/pages/patch/index.vue +3 -0
  1090. package/test/fixtures/children/pages/patch.vue +21 -0
  1091. package/test/fixtures/cli/cli.build.config.js +17 -0
  1092. package/test/fixtures/cli/cli.build.test.js +20 -0
  1093. package/test/fixtures/cli/cli.gen.config.js +21 -0
  1094. package/test/fixtures/cli/cli.gen.test.js +20 -0
  1095. package/test/fixtures/cli/custom.file +1 -0
  1096. package/test/fixtures/cli/middleware.js +1 -0
  1097. package/test/fixtures/cli/nuxt.config.js +12 -0
  1098. package/test/fixtures/cli/pages/index.vue +3 -0
  1099. package/test/fixtures/config-explicit/config-explicit.test.js +3 -0
  1100. package/test/fixtures/config-explicit/nuxt.config.js +13 -0
  1101. package/test/fixtures/config-explicit/pages/config.vue +29 -0
  1102. package/test/fixtures/custom-app-template/basic.test.js +3 -0
  1103. package/test/fixtures/custom-app-template/nuxt.config.js +6 -0
  1104. package/test/fixtures/custom-app-template/pages/index.vue +3 -0
  1105. package/test/fixtures/custom-app-template/test/mytemplate.html +15 -0
  1106. package/test/fixtures/custom-dirs/custom-assets/app.css +3 -0
  1107. package/test/fixtures/custom-dirs/custom-dirs.test.js +3 -0
  1108. package/test/fixtures/custom-dirs/custom-layouts/layouts/default.vue +6 -0
  1109. package/test/fixtures/custom-dirs/custom-middleware/user-agent.js +3 -0
  1110. package/test/fixtures/custom-dirs/custom-pages/index.vue +5 -0
  1111. package/test/fixtures/custom-dirs/custom-pages/user-agent.vue +12 -0
  1112. package/test/fixtures/custom-dirs/custom-static/test.txt +1 -0
  1113. package/test/fixtures/custom-dirs/custom-store/index.js +17 -0
  1114. package/test/fixtures/custom-dirs/nuxt.config.js +31 -0
  1115. package/test/fixtures/dynamic-routes/dynamic-routes.test.js +3 -0
  1116. package/test/fixtures/dynamic-routes/pages/_/_.vue +0 -0
  1117. package/test/fixtures/dynamic-routes/pages/_/index.vue +0 -0
  1118. package/test/fixtures/dynamic-routes/pages/_/p/_.vue +0 -0
  1119. package/test/fixtures/dynamic-routes/pages/_key/_id.vue +3 -0
  1120. package/test/fixtures/dynamic-routes/pages/_slug.vue +3 -0
  1121. package/test/fixtures/dynamic-routes/pages/index.vue +0 -0
  1122. package/test/fixtures/dynamic-routes/pages/parent/child.vue +0 -0
  1123. package/test/fixtures/dynamic-routes/pages/parent/index.vue +0 -0
  1124. package/test/fixtures/dynamic-routes/pages/parent/teub.vue +0 -0
  1125. package/test/fixtures/dynamic-routes/pages/parent.vue +0 -0
  1126. package/test/fixtures/dynamic-routes/pages/posts/_id.vue +0 -0
  1127. package/test/fixtures/dynamic-routes/pages/posts.vue +0 -0
  1128. package/test/fixtures/dynamic-routes/pages/test/_.vue +3 -0
  1129. package/test/fixtures/dynamic-routes/pages/test/index.vue +3 -0
  1130. package/test/fixtures/dynamic-routes/pages/test/projects/_category.vue +0 -0
  1131. package/test/fixtures/dynamic-routes/pages/test/projects/index.vue +0 -0
  1132. package/test/fixtures/dynamic-routes/pages/test/songs/_id.vue +0 -0
  1133. package/test/fixtures/dynamic-routes/pages/test/songs/toto.vue +0 -0
  1134. package/test/fixtures/dynamic-routes/pages/test/users/_id.vue +0 -0
  1135. package/test/fixtures/dynamic-routes/pages/test/users/_index/teub.vue +0 -0
  1136. package/test/fixtures/dynamic-routes/pages/test/users/index.vue +0 -0
  1137. package/test/fixtures/dynamic-routes/pages/test/users/projects/_category.vue +0 -0
  1138. package/test/fixtures/dynamic-routes/pages/test/users/projects/index.vue +0 -0
  1139. package/test/fixtures/dynamic-routes/pages/test/users.vue +0 -0
  1140. package/test/fixtures/dynamic-routes/pages/users/_id.vue +0 -0
  1141. package/test/fixtures/empty/empty.test.js +3 -0
  1142. package/test/fixtures/empty/pages/.gitkeep +0 -0
  1143. package/test/fixtures/encoding/encoding.test.js +3 -0
  1144. package/test/fixtures/encoding/layouts/default.vue +51 -0
  1145. package/test/fixtures/encoding/nuxt.config.js +12 -0
  1146. package/test/fixtures/encoding/pages/@about.vue +5 -0
  1147. package/test/fixtures/encoding/pages/dynamic/_id.vue +17 -0
  1148. package/test/fixtures/encoding/pages/index.vue +5 -0
  1149. package/test/fixtures/encoding/pages/redirect.vue +13 -0
  1150. package/test/fixtures/encoding/pages//321/202/320/265/321/201/321/202.vue +3 -0
  1151. package/test/fixtures/error/error.test.js +3 -0
  1152. package/test/fixtures/error/layouts/error-layout.vue +12 -0
  1153. package/test/fixtures/error/layouts/error.vue +18 -0
  1154. package/test/fixtures/error/pages/about.vue +24 -0
  1155. package/test/fixtures/error/pages/error.vue +10 -0
  1156. package/test/fixtures/error/pages/index.vue +14 -0
  1157. package/test/fixtures/error/pages/info.vue +19 -0
  1158. package/test/fixtures/extract-css/assets/global.css +15 -0
  1159. package/test/fixtures/extract-css/extract-css.test.js +3 -0
  1160. package/test/fixtures/extract-css/layouts/default.vue +15 -0
  1161. package/test/fixtures/extract-css/nuxt.config.js +25 -0
  1162. package/test/fixtures/extract-css/pages/about.vue +13 -0
  1163. package/test/fixtures/extract-css/pages/index.vue +36 -0
  1164. package/test/fixtures/fetch/components/Team.vue +27 -0
  1165. package/test/fixtures/fetch/fetch.test.js +3 -0
  1166. package/test/fixtures/fetch/layouts/default.vue +80 -0
  1167. package/test/fixtures/fetch/nuxt.config.js +1 -0
  1168. package/test/fixtures/fetch/pages/fetch-button.vue +26 -0
  1169. package/test/fixtures/fetch/pages/fetch-client.vue +22 -0
  1170. package/test/fixtures/fetch/pages/fetch-component.vue +13 -0
  1171. package/test/fixtures/fetch/pages/fetch-conditional.vue +29 -0
  1172. package/test/fixtures/fetch/pages/fetch-deep.vue +35 -0
  1173. package/test/fixtures/fetch/pages/fetch-delay.vue +24 -0
  1174. package/test/fixtures/fetch/pages/fetch-error.vue +24 -0
  1175. package/test/fixtures/fetch/pages/fetch-root.vue +21 -0
  1176. package/test/fixtures/fetch/pages/index.vue +23 -0
  1177. package/test/fixtures/fetch/pages/nested/_slug.vue +13 -0
  1178. package/test/fixtures/fetch/pages/nested/index.vue +26 -0
  1179. package/test/fixtures/fetch/pages/nested.vue +22 -0
  1180. package/test/fixtures/fetch/pages/old-fetch.vue +18 -0
  1181. package/test/fixtures/fetch/static/team.json +11 -0
  1182. package/test/fixtures/fetch/store/index.js +9 -0
  1183. package/test/fixtures/filenames-query-part/filenames-query-part.test.js +3 -0
  1184. package/test/fixtures/filenames-query-part/nuxt.config.js +8 -0
  1185. package/test/fixtures/filenames-query-part/pages/index.vue +5 -0
  1186. package/test/fixtures/full-static/full-static.test.js +3 -0
  1187. package/test/fixtures/full-static/layouts/default.vue +40 -0
  1188. package/test/fixtures/full-static/nuxt.config.js +30 -0
  1189. package/test/fixtures/full-static/pages/dynamic/_name.vue +10 -0
  1190. package/test/fixtures/full-static/pages/encoding//344/270/255/346/226/207.vue +5 -0
  1191. package/test/fixtures/full-static/pages/index.vue +5 -0
  1192. package/test/fixtures/full-static/pages/pagination/_i.vue +21 -0
  1193. package/test/fixtures/full-static/pages/payload.vue +13 -0
  1194. package/test/fixtures/full-static/pages/store.vue +18 -0
  1195. package/test/fixtures/full-static/store/auth.js +17 -0
  1196. package/test/fixtures/full-static/store/index.js +9 -0
  1197. package/test/fixtures/https/https.test.js +3 -0
  1198. package/test/fixtures/https/nuxt.config.js +11 -0
  1199. package/test/fixtures/https/pages/index.vue +3 -0
  1200. package/test/fixtures/https/server.crt +19 -0
  1201. package/test/fixtures/https/server.key +15 -0
  1202. package/test/fixtures/missing-pages-dir/missing-pages-dir.test.js +10 -0
  1203. package/test/fixtures/missing-plugin/nuxt.config.js +3 -0
  1204. package/test/fixtures/missing-style-resource/nuxt.config.js +7 -0
  1205. package/test/fixtures/modern/modern.test.js +3 -0
  1206. package/test/fixtures/modern/nuxt.config.js +16 -0
  1207. package/test/fixtures/modern/pages/index.vue +18 -0
  1208. package/test/fixtures/module/layouts/layout.vue +6 -0
  1209. package/test/fixtures/module/module.test.js +3 -0
  1210. package/test/fixtures/module/modules/basic/index.js +30 -0
  1211. package/test/fixtures/module/modules/basic/layout.vue +6 -0
  1212. package/test/fixtures/module/modules/basic/reverse.js +14 -0
  1213. package/test/fixtures/module/modules/empty/index.js +7 -0
  1214. package/test/fixtures/module/modules/hooks/index.js +28 -0
  1215. package/test/fixtures/module/modules/layout/index.js +6 -0
  1216. package/test/fixtures/module/modules/layout/some-error.vue +3 -0
  1217. package/test/fixtures/module/modules/middleware/index.js +21 -0
  1218. package/test/fixtures/module/modules/middleware/log.js +5 -0
  1219. package/test/fixtures/module/modules/middleware/midd1.js +4 -0
  1220. package/test/fixtures/module/modules/middleware/midd2.js +4 -0
  1221. package/test/fixtures/module/modules/middleware/midd3.js +7 -0
  1222. package/test/fixtures/module/modules/middleware/use-middleware.js +3 -0
  1223. package/test/fixtures/module/modules/template/index.js +12 -0
  1224. package/test/fixtures/module/nuxt.config.js +34 -0
  1225. package/test/fixtures/module/router.js +31 -0
  1226. package/test/fixtures/module/views/about.vue +8 -0
  1227. package/test/fixtures/module/views/index.vue +8 -0
  1228. package/test/fixtures/module/views/layout.vue +10 -0
  1229. package/test/fixtures/named-views/components/childLeft.vue +13 -0
  1230. package/test/fixtures/named-views/components/mainTop.vue +13 -0
  1231. package/test/fixtures/named-views/layouts/default.vue +6 -0
  1232. package/test/fixtures/named-views/named-views.test.js +3 -0
  1233. package/test/fixtures/named-views/nuxt.config.js +32 -0
  1234. package/test/fixtures/named-views/pages/another.vue +6 -0
  1235. package/test/fixtures/named-views/pages/index/child/_id/index.vue +21 -0
  1236. package/test/fixtures/named-views/pages/index/section.vue +13 -0
  1237. package/test/fixtures/named-views/pages/index.vue +16 -0
  1238. package/test/fixtures/named-views/pages/main.vue +16 -0
  1239. package/test/fixtures/page-transitions/layouts/default.vue +6 -0
  1240. package/test/fixtures/page-transitions/page-transitions.test.js +3 -0
  1241. package/test/fixtures/page-transitions/pages/callbacks/child.vue +11 -0
  1242. package/test/fixtures/page-transitions/pages/callbacks.vue +12 -0
  1243. package/test/fixtures/page-transitions/pages/index.vue +11 -0
  1244. package/test/fixtures/page-transitions/pages/transition-properties/child.vue +18 -0
  1245. package/test/fixtures/page-transitions/pages/transition-properties.vue +18 -0
  1246. package/test/fixtures/page-transitions/utils/transition-properties.js +34 -0
  1247. package/test/fixtures/route-name-splitter/nuxt.config.js +5 -0
  1248. package/test/fixtures/route-name-splitter/pages/_/_.vue +0 -0
  1249. package/test/fixtures/route-name-splitter/pages/_/index.vue +0 -0
  1250. package/test/fixtures/route-name-splitter/pages/_/p/_.vue +0 -0
  1251. package/test/fixtures/route-name-splitter/pages/index.vue +0 -0
  1252. package/test/fixtures/route-name-splitter/pages/parent/child.vue +0 -0
  1253. package/test/fixtures/route-name-splitter/pages/parent/index.vue +0 -0
  1254. package/test/fixtures/route-name-splitter/pages/posts/_id.vue +0 -0
  1255. package/test/fixtures/route-name-splitter/pages/posts.vue +0 -0
  1256. package/test/fixtures/route-name-splitter/route-name-splitter.test.js +3 -0
  1257. package/test/fixtures/runtime-config/.env +8 -0
  1258. package/test/fixtures/runtime-config/nuxt.config.js +27 -0
  1259. package/test/fixtures/runtime-config/pages/index.vue +30 -0
  1260. package/test/fixtures/runtime-config/runtime-config.test.js +3 -0
  1261. package/test/fixtures/shared-chunk/components/lazy.vue +13 -0
  1262. package/test/fixtures/shared-chunk/components/shared-vendor.vue +9 -0
  1263. package/test/fixtures/shared-chunk/components/shared.vue +5 -0
  1264. package/test/fixtures/shared-chunk/nuxt.config.js +3 -0
  1265. package/test/fixtures/shared-chunk/pages/_cat/_id/_sub.vue +6 -0
  1266. package/test/fixtures/shared-chunk/pages/index.vue +14 -0
  1267. package/test/fixtures/shared-chunk/pages/product/_identifier.vue +6 -0
  1268. package/test/fixtures/sockets/nuxt.config.js +7 -0
  1269. package/test/fixtures/sockets/pages/index.vue +3 -0
  1270. package/test/fixtures/sockets/sockets.test.js +5 -0
  1271. package/test/fixtures/spa/layouts/custom.vue +7 -0
  1272. package/test/fixtures/spa/layouts/default.vue +7 -0
  1273. package/test/fixtures/spa/middleware/middleware.js +14 -0
  1274. package/test/fixtures/spa/nuxt.config.js +37 -0
  1275. package/test/fixtures/spa/pages/async.vue +20 -0
  1276. package/test/fixtures/spa/pages/custom.vue +15 -0
  1277. package/test/fixtures/spa/pages/error-handler-async.vue +9 -0
  1278. package/test/fixtures/spa/pages/error-handler-object.vue +8 -0
  1279. package/test/fixtures/spa/pages/error-handler-string.vue +8 -0
  1280. package/test/fixtures/spa/pages/error-handler.vue +8 -0
  1281. package/test/fixtures/spa/pages/index.vue +12 -0
  1282. package/test/fixtures/spa/pages/mounted.vue +20 -0
  1283. package/test/fixtures/spa/pages/redirect-done.vue +17 -0
  1284. package/test/fixtures/spa/pages/route-path.vue +3 -0
  1285. package/test/fixtures/spa/pages//321/202/320/265/321/201/321/202/351/233/250.vue +11 -0
  1286. package/test/fixtures/spa/plugins/error.js +5 -0
  1287. package/test/fixtures/spa/plugins/path.js +4 -0
  1288. package/test/fixtures/spa/spa.test.js +7 -0
  1289. package/test/fixtures/spa-base/nuxt.config.js +13 -0
  1290. package/test/fixtures/spa-hash/nuxt.config.js +13 -0
  1291. package/test/fixtures/split-layouts-error/layouts/error-layout.vue +12 -0
  1292. package/test/fixtures/split-layouts-error/layouts/error.vue +18 -0
  1293. package/test/fixtures/split-layouts-error/nuxt.config.js +7 -0
  1294. package/test/fixtures/split-layouts-error/pages/about.vue +8 -0
  1295. package/test/fixtures/split-layouts-error/pages/error.vue +12 -0
  1296. package/test/fixtures/split-layouts-error/pages/index.vue +14 -0
  1297. package/test/fixtures/split-layouts-error/pages/info.vue +24 -0
  1298. package/test/fixtures/split-layouts-error/split-layouts-error.test.js +3 -0
  1299. package/test/fixtures/ssr/components/test.vue +15 -0
  1300. package/test/fixtures/ssr/lib/db.js +4 -0
  1301. package/test/fixtures/ssr/nuxt.config.js +8 -0
  1302. package/test/fixtures/ssr/pages/asyncComponent.vue +15 -0
  1303. package/test/fixtures/ssr/pages/asyncData.vue +15 -0
  1304. package/test/fixtures/ssr/pages/component.vue +15 -0
  1305. package/test/fixtures/ssr/pages/context/_id.vue +6 -0
  1306. package/test/fixtures/ssr/pages/context.vue +10 -0
  1307. package/test/fixtures/ssr/pages/data.vue +15 -0
  1308. package/test/fixtures/ssr/pages/fetch.vue +14 -0
  1309. package/test/fixtures/ssr/pages/store.vue +3 -0
  1310. package/test/fixtures/ssr/ssr.test.js +3 -0
  1311. package/test/fixtures/ssr/store/index.js +23 -0
  1312. package/test/fixtures/trailing-slash/pages/index.vue +5 -0
  1313. package/test/fixtures/trailing-slash/pages/posts/_slug.vue +16 -0
  1314. package/test/fixtures/trailing-slash/pages/posts/index.vue +5 -0
  1315. package/test/fixtures/trailing-slash/pages/posts.vue +6 -0
  1316. package/test/fixtures/trailing-slash/trailing-slash.test.js +5 -0
  1317. package/test/fixtures/trailing-slash/with-default/nuxt.config.js +10 -0
  1318. package/test/fixtures/trailing-slash/with-false/nuxt.config.js +10 -0
  1319. package/test/fixtures/trailing-slash/with-true/nuxt.config.js +10 -0
  1320. package/test/fixtures/with-config/.nuxtignore +4 -0
  1321. package/test/fixtures/with-config/app.html +10 -0
  1322. package/test/fixtures/with-config/assets/app.pcss +10 -0
  1323. package/test/fixtures/with-config/assets/app.sass +2 -0
  1324. package/test/fixtures/with-config/assets/pre-process.css +3 -0
  1325. package/test/fixtures/with-config/assets/roboto.woff2 +0 -0
  1326. package/test/fixtures/with-config/components/loading.vue +36 -0
  1327. package/test/fixtures/with-config/layouts/custom-env.vue +6 -0
  1328. package/test/fixtures/with-config/layouts/custom.vue +6 -0
  1329. package/test/fixtures/with-config/layouts/default.vue +6 -0
  1330. package/test/fixtures/with-config/layouts/desktop/default.vue +6 -0
  1331. package/test/fixtures/with-config/layouts/error.vue +9 -0
  1332. package/test/fixtures/with-config/layouts/mobile/default.vue +6 -0
  1333. package/test/fixtures/with-config/layouts/test-ignore.vue +1 -0
  1334. package/test/fixtures/with-config/middleware/noop.js +3 -0
  1335. package/test/fixtures/with-config/middleware/test-ignore.js +1 -0
  1336. package/test/fixtures/with-config/middleware/user-agent.js +3 -0
  1337. package/test/fixtures/with-config/nuxt.config.js +118 -0
  1338. package/test/fixtures/with-config/pages/about.vue +18 -0
  1339. package/test/fixtures/with-config/pages/desktop.vue +11 -0
  1340. package/test/fixtures/with-config/pages/env.vue +23 -0
  1341. package/test/fixtures/with-config/pages/error.vue +11 -0
  1342. package/test/fixtures/with-config/pages/head.vue +13 -0
  1343. package/test/fixtures/with-config/pages/index.vue +21 -0
  1344. package/test/fixtures/with-config/pages/mobile.vue +11 -0
  1345. package/test/fixtures/with-config/pages/test-ignore.vue +0 -0
  1346. package/test/fixtures/with-config/pages/user-agent.vue +12 -0
  1347. package/test/fixtures/with-config/plugins/doubled/index.js +1 -0
  1348. package/test/fixtures/with-config/plugins/only-client.js +1 -0
  1349. package/test/fixtures/with-config/plugins/test.client.js +1 -0
  1350. package/test/fixtures/with-config/plugins/test.js +7 -0
  1351. package/test/fixtures/with-config/plugins/test.json +0 -0
  1352. package/test/fixtures/with-config/plugins/test.plugin.js +5 -0
  1353. package/test/fixtures/with-config/plugins/test.server.js +1 -0
  1354. package/test/fixtures/with-config/postcss.config.js +14 -0
  1355. package/test/fixtures/with-config/static/test.txt +1 -0
  1356. package/test/fixtures/with-config/store/index.js +17 -0
  1357. package/test/fixtures/with-config/store/test-ignore.js +1 -0
  1358. package/test/fixtures/with-config/with-config.test.js +38 -0
  1359. package/test/utils/browser.js +110 -0
  1360. package/test/utils/build.js +21 -0
  1361. package/test/utils/index.js +30 -0
  1362. package/test/utils/nuxt.js +35 -0
  1363. package/test/utils/resource-size.js +35 -0
  1364. package/test/utils/setup-env.js +35 -0
  1365. package/test/utils/setup.js +6 -0
@@ -0,0 +1,102 @@
1
+ import path from 'path'
2
+ import consola from 'consola'
3
+ import hash from 'hash-sum'
4
+ import fs from 'fs-extra'
5
+ import properlock from 'proper-lockfile'
6
+ import onExit from 'signal-exit'
7
+
8
+ export const lockPaths = new Set()
9
+
10
+ export const defaultLockOptions = {
11
+ stale: 30000,
12
+ onCompromised: err => consola.warn(err)
13
+ }
14
+
15
+ export function getLockOptions (options) {
16
+ return Object.assign({}, defaultLockOptions, options)
17
+ }
18
+
19
+ export function createLockPath ({ id = 'nuxt', dir, root }) {
20
+ const sum = hash(`${root}-${dir}`)
21
+
22
+ return path.resolve(root, 'node_modules/.cache/nuxt', `${id}-lock-${sum}`)
23
+ }
24
+
25
+ export async function getLockPath (config) {
26
+ const lockPath = createLockPath(config)
27
+
28
+ // the lock is created for the lockPath as ${lockPath}.lock
29
+ // so the (temporary) lockPath needs to exist
30
+ await fs.ensureDir(lockPath)
31
+
32
+ return lockPath
33
+ }
34
+
35
+ export async function lock ({ id, dir, root, options }) {
36
+ const lockPath = await getLockPath({ id, dir, root })
37
+
38
+ try {
39
+ const locked = await properlock.check(lockPath)
40
+ if (locked) {
41
+ consola.fatal(`A lock with id '${id}' already exists on ${dir}`)
42
+ }
43
+ } catch (e) {
44
+ consola.debug(`Check for an existing lock with id '${id}' on ${dir} failed`, e)
45
+ }
46
+
47
+ let lockWasCompromised = false
48
+ let release
49
+
50
+ try {
51
+ options = getLockOptions(options)
52
+
53
+ const onCompromised = options.onCompromised
54
+ options.onCompromised = (err) => {
55
+ onCompromised(err)
56
+ lockWasCompromised = true
57
+ }
58
+
59
+ release = await properlock.lock(lockPath, options)
60
+ } catch (e) {}
61
+
62
+ if (!release) {
63
+ consola.warn(`Unable to get a lock with id '${id}' on ${dir} (but will continue)`)
64
+ return false
65
+ }
66
+
67
+ if (!lockPaths.size) {
68
+ // make sure to always cleanup our temporary lockPaths
69
+ onExit(() => {
70
+ for (const lockPath of lockPaths) {
71
+ fs.removeSync(lockPath)
72
+ }
73
+ })
74
+ }
75
+
76
+ lockPaths.add(lockPath)
77
+
78
+ return async function lockRelease () {
79
+ try {
80
+ await fs.remove(lockPath)
81
+ lockPaths.delete(lockPath)
82
+
83
+ // release as last so the lockPath is still removed
84
+ // when it fails on a compromised lock
85
+ await release()
86
+ } catch (e) {
87
+ if (!lockWasCompromised || !e.message.includes('already released')) {
88
+ consola.debug(e)
89
+ return
90
+ }
91
+
92
+ // proper-lockfile doesnt remove lockDir when lock is compromised
93
+ // removing it here could cause the 'other' process to throw an error
94
+ // as well, but in our case its much more likely the lock was
95
+ // compromised due to mtime update timeouts
96
+ const lockDir = `${lockPath}.lock`
97
+ if (await fs.exists(lockDir)) {
98
+ await fs.remove(lockDir)
99
+ }
100
+ }
101
+ }
102
+ }
@@ -0,0 +1,61 @@
1
+ import UAParser from 'ua-parser-js'
2
+ import semver from 'semver'
3
+
4
+ export const ModernBrowsers = {
5
+ Edge: '16',
6
+ Firefox: '60',
7
+ Chrome: '61',
8
+ 'Chrome Headless': '61',
9
+ Chromium: '61',
10
+ Iron: '61',
11
+ Safari: '10.1',
12
+ Opera: '48',
13
+ Yandex: '18',
14
+ Vivaldi: '1.14',
15
+ 'Mobile Safari': '10.3'
16
+ }
17
+
18
+ let __modernBrowsers
19
+
20
+ const getModernBrowsers = () => {
21
+ if (__modernBrowsers) {
22
+ return __modernBrowsers
23
+ }
24
+
25
+ __modernBrowsers = Object.keys(ModernBrowsers)
26
+ .reduce((allBrowsers, browser) => {
27
+ allBrowsers[browser] = semver.coerce(ModernBrowsers[browser])
28
+ return allBrowsers
29
+ }, {})
30
+ return __modernBrowsers
31
+ }
32
+
33
+ export const isModernBrowser = (ua) => {
34
+ if (!ua) {
35
+ return false
36
+ }
37
+ const { browser } = UAParser(ua)
38
+ const browserVersion = semver.coerce(browser.version)
39
+ if (!browserVersion) {
40
+ return false
41
+ }
42
+ const modernBrowsers = getModernBrowsers()
43
+ return Boolean(modernBrowsers[browser.name] && semver.gte(browserVersion, modernBrowsers[browser.name]))
44
+ }
45
+
46
+ export const isModernRequest = (req, modernMode = false) => {
47
+ if (modernMode === false) {
48
+ return false
49
+ }
50
+
51
+ const { socket = {}, headers } = req
52
+ if (socket._modern === undefined) {
53
+ const ua = headers && headers['user-agent']
54
+ socket._modern = isModernBrowser(ua)
55
+ }
56
+
57
+ return socket._modern
58
+ }
59
+
60
+ // https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc
61
+ export const safariNoModuleFix = '!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();'
@@ -0,0 +1,110 @@
1
+ import path from 'path'
2
+ import consola from 'consola'
3
+ import { escapeRegExp } from 'lodash'
4
+
5
+ export const startsWithAlias = aliasArray => str => aliasArray.some(c => str.startsWith(c))
6
+
7
+ export const startsWithSrcAlias = startsWithAlias(['@', '~'])
8
+
9
+ export const startsWithRootAlias = startsWithAlias(['@@', '~~'])
10
+
11
+ export const isWindows = process.platform.startsWith('win')
12
+
13
+ export const wp = function wp (p = '') {
14
+ if (isWindows) {
15
+ return p.replace(/\\/g, '\\\\')
16
+ }
17
+ return p
18
+ }
19
+
20
+ // Kept for backward compat (modules may use it from template context)
21
+ export const wChunk = function wChunk (p = '') {
22
+ return p
23
+ }
24
+
25
+ const reqSep = /\//g
26
+ const sysSep = escapeRegExp(path.sep)
27
+ const normalize = string => string.replace(reqSep, sysSep)
28
+
29
+ export const r = function r (...args) {
30
+ const lastArg = args[args.length - 1]
31
+
32
+ if (startsWithSrcAlias(lastArg)) {
33
+ return wp(lastArg)
34
+ }
35
+
36
+ return wp(path.resolve(...args.map(normalize)))
37
+ }
38
+
39
+ export const relativeTo = function relativeTo (...args) {
40
+ const dir = args.shift()
41
+
42
+ // Keep webpack inline loader intact
43
+ if (args[0].includes('!')) {
44
+ const loaders = args.shift().split('!')
45
+
46
+ return loaders.concat(relativeTo(dir, loaders.pop(), ...args)).join('!')
47
+ }
48
+
49
+ // Resolve path
50
+ const resolvedPath = r(...args)
51
+
52
+ // Check if path is an alias
53
+ if (startsWithSrcAlias(resolvedPath)) {
54
+ return resolvedPath
55
+ }
56
+
57
+ // Make correct relative path
58
+ let rp = path.relative(dir, resolvedPath)
59
+ if (rp[0] !== '.') {
60
+ rp = '.' + path.sep + rp
61
+ }
62
+
63
+ return wp(rp)
64
+ }
65
+
66
+ export function defineAlias (src, target, prop, opts = {}) {
67
+ const { bind = true, warn = false } = opts
68
+
69
+ if (Array.isArray(prop)) {
70
+ for (const p of prop) {
71
+ defineAlias(src, target, p, opts)
72
+ }
73
+ return
74
+ }
75
+
76
+ let targetVal = target[prop]
77
+ if (bind && typeof targetVal === 'function') {
78
+ targetVal = targetVal.bind(target)
79
+ }
80
+
81
+ let warned = false
82
+
83
+ Object.defineProperty(src, prop, {
84
+ get: () => {
85
+ if (warn && !warned) {
86
+ warned = true
87
+ consola.warn({
88
+ message: `'${prop}' is deprecated'`,
89
+ // eslint-disable-next-line unicorn/error-message
90
+ additional: new Error().stack.split('\n').splice(2).join('\n')
91
+ })
92
+ }
93
+ return targetVal
94
+ }
95
+ })
96
+ }
97
+
98
+ const isIndex = s => /(.*)\/index\.[^/]+$/.test(s)
99
+
100
+ export function isIndexFileAndFolder (pluginFiles) {
101
+ // Return early in case the matching file count exceeds 2 (index.js + folder)
102
+ if (pluginFiles.length !== 2) {
103
+ return false
104
+ }
105
+ return pluginFiles.some(isIndex)
106
+ }
107
+
108
+ export const getMainModule = () => {
109
+ return (require && require.main) || (module && module.main) || module
110
+ }
@@ -0,0 +1,280 @@
1
+ import path from 'path'
2
+ import { get } from 'lodash'
3
+ import consola from 'consola'
4
+ import { normalizeURL, withTrailingSlash, withoutTrailingSlash } from 'ufo'
5
+ import { r } from './resolve'
6
+
7
+ const routeChildren = function (route) {
8
+ const hasChildWithEmptyPath = route.children.some(child => child.path === '')
9
+ if (hasChildWithEmptyPath) {
10
+ return route.children
11
+ }
12
+ return [
13
+ // Add default child to render parent page
14
+ {
15
+ ...route,
16
+ children: undefined
17
+ },
18
+ ...route.children
19
+ ]
20
+ }
21
+
22
+ export const flatRoutes = function flatRoutes (router, fileName = '', routes = []) {
23
+ router.forEach((r) => {
24
+ if ([':', '*'].some(c => r.path.includes(c))) {
25
+ return
26
+ }
27
+ const route = `${fileName}${r.path}/`.replace(/\/+/g, '/')
28
+ if (r.children) {
29
+ return flatRoutes(routeChildren(r), route, routes)
30
+ }
31
+
32
+ // if child path is already absolute, do not make any concatenations
33
+ if (r.path && r.path.startsWith('/')) {
34
+ routes.push(r.path)
35
+ } else if (route !== '/' && route[route.length - 1] === '/') {
36
+ routes.push(route.slice(0, -1))
37
+ } else {
38
+ routes.push(route)
39
+ }
40
+ })
41
+ return routes
42
+ }
43
+
44
+ // eslint-disable-next-line default-param-last
45
+ function cleanChildrenRoutes (routes, isChild = false, routeNameSplitter = '-', trailingSlash, parentRouteName) {
46
+ const regExpIndex = new RegExp(`${routeNameSplitter}index$`)
47
+ const regExpParentRouteName = new RegExp(`^${parentRouteName}${routeNameSplitter}`)
48
+ const routesIndex = []
49
+ routes.forEach((route) => {
50
+ if (regExpIndex.test(route.name) || route.name === 'index') {
51
+ const res = route.name.replace(regExpParentRouteName, '').split(routeNameSplitter)
52
+ routesIndex.push(res)
53
+ }
54
+ })
55
+ routes.forEach((route) => {
56
+ route.path = isChild ? route.path.replace('/', '') : route.path
57
+ if (route.path.includes('?')) {
58
+ if (route.name.endsWith(`${routeNameSplitter}index`)) {
59
+ route.path = route.path.replace(/\?$/, '')
60
+ }
61
+ const names = route.name.replace(regExpParentRouteName, '').split(routeNameSplitter)
62
+ const paths = route.path.split('/')
63
+ if (!isChild) {
64
+ paths.shift()
65
+ } // clean first / for parents
66
+ routesIndex.forEach((r) => {
67
+ const i = r.indexOf('index')
68
+ if (i < paths.length) {
69
+ for (let a = 0; a <= i; a++) {
70
+ if (a === i) {
71
+ paths[a] = paths[a].replace('?', '')
72
+ }
73
+ if (a < i && names[a] !== r[a]) {
74
+ break
75
+ }
76
+ }
77
+ }
78
+ })
79
+ route.path = (isChild ? '' : '/') + paths.join('/')
80
+ }
81
+ route.name = route.name.replace(regExpIndex, '')
82
+ if (route.children) {
83
+ const defaultChildRoute = route.children.find(child => child.path === '/' || child.path === '')
84
+ const routeName = route.name
85
+ if (defaultChildRoute) {
86
+ route.children.forEach((child) => {
87
+ if (child.path !== defaultChildRoute.path) {
88
+ const parts = child.path.split('/')
89
+ parts[1] = parts[1].endsWith('?') ? parts[1].substr(0, parts[1].length - 1) : parts[1]
90
+ child.path = parts.join('/')
91
+ }
92
+ })
93
+ delete route.name
94
+ }
95
+ route.children = cleanChildrenRoutes(route.children, true, routeNameSplitter, trailingSlash, routeName)
96
+ }
97
+ })
98
+ return routes
99
+ }
100
+
101
+ const DYNAMIC_ROUTE_REGEX = /^\/([:*])/
102
+
103
+ export const sortRoutes = function sortRoutes (routes) {
104
+ routes.sort((a, b) => {
105
+ if (!a.path.length) {
106
+ return -1
107
+ }
108
+ if (!b.path.length) {
109
+ return 1
110
+ }
111
+ // Order: /static, /index, /:dynamic
112
+ // Match exact route before index: /login before /index/_slug
113
+ if (a.path === '/') {
114
+ return DYNAMIC_ROUTE_REGEX.test(b.path) ? -1 : 1
115
+ }
116
+ if (b.path === '/') {
117
+ return DYNAMIC_ROUTE_REGEX.test(a.path) ? 1 : -1
118
+ }
119
+
120
+ let i
121
+ let res = 0
122
+ let y = 0
123
+ let z = 0
124
+ const _a = a.path.split('/')
125
+ const _b = b.path.split('/')
126
+ for (i = 0; i < _a.length; i++) {
127
+ if (res !== 0) {
128
+ break
129
+ }
130
+ y = _a[i] === '*' ? 2 : _a[i].includes(':') ? 1 : 0
131
+ z = _b[i] === '*' ? 2 : _b[i].includes(':') ? 1 : 0
132
+ res = y - z
133
+ // If a.length >= b.length
134
+ if (i === _b.length - 1 && res === 0) {
135
+ // unless * found sort by level, then alphabetically
136
+ res = _a[i] === '*'
137
+ ? -1
138
+ : (
139
+ _a.length === _b.length ? a.path.localeCompare(b.path) : (_a.length - _b.length)
140
+ )
141
+ }
142
+ }
143
+
144
+ if (res === 0) {
145
+ // unless * found sort by level, then alphabetically
146
+ res = _a[i - 1] === '*' && _b[i]
147
+ ? 1
148
+ : (
149
+ _a.length === _b.length ? a.path.localeCompare(b.path) : (_a.length - _b.length)
150
+ )
151
+ }
152
+ return res
153
+ })
154
+
155
+ routes.forEach((route) => {
156
+ if (route.children) {
157
+ sortRoutes(route.children)
158
+ }
159
+ })
160
+
161
+ return routes
162
+ }
163
+
164
+ export const createRoutes = function createRoutes ({
165
+ files,
166
+ srcDir,
167
+ pagesDir = '',
168
+ routeNameSplitter = '-',
169
+ supportedExtensions = ['vue', 'js'],
170
+ trailingSlash
171
+ }) {
172
+ const routes = []
173
+ files.forEach((file) => {
174
+ const keys = file
175
+ .replace(new RegExp(`^${pagesDir}`), '')
176
+ .replace(new RegExp(`\\.(${supportedExtensions.join('|')})$`), '')
177
+ .replace(/\/{2,}/g, '/')
178
+ .split('/')
179
+ .slice(1)
180
+ const route = { name: '', path: '', component: r(srcDir, file) }
181
+ let parent = routes
182
+ keys.forEach((key, i) => {
183
+ // remove underscore only, if its the prefix
184
+ const sanitizedKey = key.startsWith('_') ? key.substr(1) : key
185
+
186
+ route.name = route.name
187
+ ? route.name + routeNameSplitter + sanitizedKey
188
+ : sanitizedKey
189
+ route.name += key === '_' ? 'all' : ''
190
+ route.chunkName = file.replace(new RegExp(`\\.(${supportedExtensions.join('|')})$`), '')
191
+ const child = parent.find(parentRoute => parentRoute.name === route.name)
192
+
193
+ if (child) {
194
+ child.children = child.children || []
195
+ parent = child.children
196
+ route.path = ''
197
+ } else if (key === 'index' && i + 1 === keys.length) {
198
+ route.path += i > 0 ? '' : '/'
199
+ } else {
200
+ route.path += '/' + normalizeURL(getRoutePathExtension(key))
201
+ if (key.startsWith('_') && key.length > 1) {
202
+ route.path += '?'
203
+ }
204
+ }
205
+ })
206
+ if (trailingSlash !== undefined) {
207
+ route.pathToRegexpOptions = { ...route.pathToRegexpOptions, strict: true }
208
+ if (trailingSlash && !route.path.endsWith('*')) {
209
+ route.path = withTrailingSlash(route.path)
210
+ } else {
211
+ route.path = withoutTrailingSlash(route.path)
212
+ }
213
+ }
214
+
215
+ parent.push(route)
216
+ })
217
+
218
+ sortRoutes(routes)
219
+ return cleanChildrenRoutes(routes, false, routeNameSplitter, trailingSlash)
220
+ }
221
+
222
+ // Guard dir1 from dir2 which can be indiscriminately removed
223
+ export const guardDir = function guardDir (options, key1, key2) {
224
+ const dir1 = get(options, key1, false)
225
+ const dir2 = get(options, key2, false)
226
+
227
+ if (
228
+ dir1 &&
229
+ dir2 &&
230
+ (
231
+ dir1 === dir2 ||
232
+ (
233
+ dir1.startsWith(dir2) &&
234
+ !path.basename(dir1).startsWith(path.basename(dir2))
235
+ )
236
+ )
237
+ ) {
238
+ const errorMessage = `options.${key2} cannot be a parent of or same as ${key1}`
239
+ consola.fatal(errorMessage)
240
+ throw new Error(errorMessage)
241
+ }
242
+ }
243
+
244
+ const getRoutePathExtension = (key) => {
245
+ if (key === '_') {
246
+ return '*'
247
+ }
248
+
249
+ if (key.startsWith('_')) {
250
+ return `:${key.substr(1)}`
251
+ }
252
+
253
+ return key
254
+ }
255
+
256
+ export const promisifyRoute = function promisifyRoute (fn, ...args) {
257
+ // If routes is an array
258
+ if (Array.isArray(fn)) {
259
+ return Promise.resolve(fn)
260
+ }
261
+ // If routes is a function expecting a callback
262
+ if (fn.length === arguments.length) {
263
+ return new Promise((resolve, reject) => {
264
+ fn((err, routeParams) => {
265
+ if (err) {
266
+ reject(err)
267
+ }
268
+ resolve(routeParams)
269
+ }, ...args)
270
+ })
271
+ }
272
+ let promise = fn(...args)
273
+ if (
274
+ !promise ||
275
+ (!(promise instanceof Promise) && typeof promise.then !== 'function')
276
+ ) {
277
+ promise = Promise.resolve(promise)
278
+ }
279
+ return promise
280
+ }
@@ -0,0 +1,52 @@
1
+ import serialize from 'serialize-javascript'
2
+
3
+ export function normalizeFunctions (obj) {
4
+ if (typeof obj !== 'object' || Array.isArray(obj) || obj === null) {
5
+ return obj
6
+ }
7
+ for (const key in obj) {
8
+ if (key === '__proto__' || key === 'constructor') {
9
+ continue
10
+ }
11
+ const val = obj[key]
12
+ if (val !== null && typeof val === 'object' && !Array.isArray(obj)) {
13
+ obj[key] = normalizeFunctions(val)
14
+ }
15
+ if (typeof obj[key] === 'function') {
16
+ const asString = obj[key].toString()
17
+ const match = asString.match(/^([^{(]+)=>\s*([\0-\uFFFF]*)/)
18
+ if (match) {
19
+ const fullFunctionBody = match[2].match(/^{?(\s*return\s+)?([\0-\uFFFF]*?)}?$/)
20
+ let functionBody = fullFunctionBody[2].trim()
21
+ if (fullFunctionBody[1] || !match[2].trim().match(/^\s*{/)) {
22
+ functionBody = `return ${functionBody}`
23
+ }
24
+ // eslint-disable-next-line no-new-func
25
+ obj[key] = new Function(...match[1].split(',').map(arg => arg.trim()), functionBody)
26
+ }
27
+ }
28
+ }
29
+ return obj
30
+ }
31
+
32
+ export function serializeFunction (func) {
33
+ let open = false
34
+ func = normalizeFunctions(func)
35
+ return serialize(func)
36
+ .replace(serializeFunction.assignmentRE, (_, spaces) => {
37
+ return `${spaces}: function (`
38
+ })
39
+ .replace(serializeFunction.internalFunctionRE, (_, spaces, name, args) => {
40
+ if (open) {
41
+ return `${spaces}${name}: function (${args}) {`
42
+ } else {
43
+ open = true
44
+ return _
45
+ }
46
+ })
47
+ .replace(new RegExp(`${(func.name || 'function').replace('$', '\\$')}\\s*\\(`), 'function(')
48
+ .replace('function function', 'function')
49
+ }
50
+
51
+ serializeFunction.internalFunctionRE = /^(\s*)(?!(?:if)|(?:for)|(?:while)|(?:switch)|(?:catch))(\w+)\s*\((.*?)\)\s*\{/gm
52
+ serializeFunction.assignmentRE = /^(\s*):(\w+)\(/gm
@@ -0,0 +1,40 @@
1
+ export const sequence = function sequence (tasks, fn) {
2
+ return tasks.reduce(
3
+ (promise, task) => promise.then(() => fn(task)),
4
+ Promise.resolve()
5
+ )
6
+ }
7
+
8
+ export const parallel = function parallel (tasks, fn) {
9
+ return Promise.all(tasks.map(fn))
10
+ }
11
+
12
+ export const chainFn = function chainFn (base, fn) {
13
+ if (typeof fn !== 'function') {
14
+ return base
15
+ }
16
+
17
+ if (typeof base !== 'function') {
18
+ return fn
19
+ }
20
+
21
+ return function (arg0, ...args) {
22
+ const next = (previous = arg0) => {
23
+ const fnResult = fn.call(this, previous, ...args)
24
+
25
+ if (fnResult && typeof fnResult.then === 'function') {
26
+ return fnResult.then(res => res || previous)
27
+ }
28
+
29
+ return fnResult || previous
30
+ }
31
+
32
+ const baseResult = base.call(this, arg0, ...args)
33
+
34
+ if (baseResult && typeof baseResult.then === 'function') {
35
+ return baseResult.then(res => next(res))
36
+ }
37
+
38
+ return next(baseResult)
39
+ }
40
+ }
@@ -0,0 +1,65 @@
1
+ async function promiseFinally (fn, finalFn) {
2
+ let result
3
+ try {
4
+ if (typeof fn === 'function') {
5
+ result = await fn()
6
+ } else {
7
+ result = await fn
8
+ }
9
+ } finally {
10
+ finalFn()
11
+ }
12
+ return result
13
+ }
14
+
15
+ export const timeout = function timeout (fn, ms, msg) {
16
+ let timerId
17
+ const warpPromise = promiseFinally(fn, () => clearTimeout(timerId))
18
+ const timerPromise = new Promise((resolve, reject) => {
19
+ timerId = setTimeout(() => reject(new Error(msg)), ms)
20
+ })
21
+ return Promise.race([warpPromise, timerPromise])
22
+ }
23
+
24
+ export const waitFor = function waitFor (ms) {
25
+ return new Promise(resolve => setTimeout(resolve, ms || 0))
26
+ }
27
+ export class Timer {
28
+ constructor () {
29
+ this._times = new Map()
30
+ }
31
+
32
+ start (name, description) {
33
+ const time = {
34
+ name,
35
+ description,
36
+ start: this.hrtime()
37
+ }
38
+ this._times.set(name, time)
39
+ return time
40
+ }
41
+
42
+ end (name) {
43
+ if (this._times.has(name)) {
44
+ const time = this._times.get(name)
45
+ time.duration = this.hrtime(time.start)
46
+ this._times.delete(name)
47
+ return time
48
+ }
49
+ }
50
+
51
+ hrtime (start) {
52
+ const useBigInt = typeof process.hrtime.bigint === 'function'
53
+ if (start) {
54
+ const end = useBigInt ? process.hrtime.bigint() : process.hrtime(start)
55
+ return useBigInt
56
+ ? (end - start) / BigInt(1000000)
57
+ : (end[0] * 1e3) + (end[1] * 1e-6)
58
+ }
59
+ return useBigInt ? process.hrtime.bigint() : process.hrtime()
60
+ }
61
+
62
+ clear () {
63
+ this._times.clear()
64
+ }
65
+ }