primate 0.32.7 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/lib/app.tsconfig.json +55 -0
  2. package/lib/bin.d.ts +3 -0
  3. package/{src → lib}/bin.js +1 -0
  4. package/lib/commands/build.d.ts +4 -0
  5. package/lib/commands/build.js +9 -0
  6. package/lib/commands/dev.d.ts +3 -0
  7. package/lib/commands/dev.js +8 -0
  8. package/lib/commands/index.d.ts +3 -0
  9. package/lib/commands/index.js +13 -0
  10. package/lib/commands/init.d.ts +2 -0
  11. package/lib/commands/init.js +348 -0
  12. package/lib/commands/serve.d.ts +3 -0
  13. package/lib/commands/serve.js +13 -0
  14. package/lib/commands/test.d.ts +3 -0
  15. package/lib/commands/test.js +133 -0
  16. package/lib/init.d.ts +3 -0
  17. package/lib/init.js +12 -0
  18. package/lib/private/test.d.ts +32 -0
  19. package/lib/private/test.js +8 -0
  20. package/lib/public/Loader.d.ts +2 -0
  21. package/lib/public/Loader.js +2 -0
  22. package/lib/public/Module.d.ts +2 -0
  23. package/lib/public/Module.js +2 -0
  24. package/lib/public/RequestFacade.d.ts +2 -0
  25. package/lib/public/RequestFacade.js +2 -0
  26. package/lib/public/client/app.d.ts +4 -0
  27. package/lib/public/client/app.js +3 -0
  28. package/lib/public/config/i18n.d.ts +2 -0
  29. package/lib/public/config/i18n.js +2 -0
  30. package/lib/public/config/session.d.ts +2 -0
  31. package/lib/public/config/session.js +2 -0
  32. package/lib/public/config.d.ts +2 -0
  33. package/lib/public/config.js +2 -0
  34. package/lib/public/database/default.d.ts +2 -0
  35. package/lib/public/database/default.js +2 -0
  36. package/lib/public/database/wrap.d.ts +2 -0
  37. package/lib/public/database/wrap.js +2 -0
  38. package/lib/public/i18n/locale.d.ts +2 -0
  39. package/lib/public/i18n/locale.js +2 -0
  40. package/lib/public/load-text.d.ts +4 -0
  41. package/lib/public/load-text.js +3 -0
  42. package/lib/public/request/Facade.d.ts +2 -0
  43. package/lib/public/request/Facade.js +2 -0
  44. package/lib/public/response/Status.d.ts +2 -0
  45. package/lib/public/response/Status.js +2 -0
  46. package/lib/public/response/binary.d.ts +2 -0
  47. package/lib/public/response/binary.js +2 -0
  48. package/lib/public/response/error.d.ts +2 -0
  49. package/lib/public/response/error.js +2 -0
  50. package/lib/public/response/json.d.ts +2 -0
  51. package/lib/public/response/json.js +2 -0
  52. package/lib/public/response/redirect.d.ts +2 -0
  53. package/lib/public/response/redirect.js +2 -0
  54. package/lib/public/response/sse.d.ts +2 -0
  55. package/lib/public/response/sse.js +2 -0
  56. package/lib/public/response/text.d.ts +2 -0
  57. package/lib/public/response/text.js +2 -0
  58. package/lib/public/response/view.d.ts +2 -0
  59. package/lib/public/response/view.js +2 -0
  60. package/lib/public/response/ws.d.ts +2 -0
  61. package/lib/public/response/ws.js +2 -0
  62. package/lib/public/response.d.ts +22 -0
  63. package/lib/public/response.js +19 -0
  64. package/lib/public/route.d.ts +3 -0
  65. package/lib/public/route.js +3 -0
  66. package/lib/public/router.d.ts +2 -0
  67. package/lib/public/router.js +2 -0
  68. package/lib/public/s/config.d.ts +2 -0
  69. package/lib/public/s/config.js +2 -0
  70. package/lib/public/s/internal.d.ts +2 -0
  71. package/lib/public/s/internal.js +2 -0
  72. package/lib/public/serve.d.ts +2 -0
  73. package/{src → lib}/public/serve.js +1 -0
  74. package/lib/public/session/Manager.d.ts +2 -0
  75. package/lib/public/session/Manager.js +2 -0
  76. package/lib/public/store.d.ts +4 -0
  77. package/lib/public/store.js +3 -0
  78. package/lib/public/symbol/config.d.ts +2 -0
  79. package/lib/public/symbol/config.js +2 -0
  80. package/lib/public/test.d.ts +2 -0
  81. package/lib/public/test.js +2 -0
  82. package/lib/public/wasm/instantiate.d.ts +2 -0
  83. package/lib/public/wasm/instantiate.js +2 -0
  84. package/lib/runtime/FileRef.d.ts +2 -0
  85. package/lib/runtime/FileRef.js +2 -0
  86. package/package.json +47 -23
  87. package/src/commands/build.js +0 -4
  88. package/src/commands/dev.js +0 -8
  89. package/src/commands/exports.js +0 -5
  90. package/src/commands/serve.js +0 -8
  91. package/src/handlers/error.js +0 -1
  92. package/src/handlers/json.js +0 -1
  93. package/src/handlers/redirect.js +0 -1
  94. package/src/handlers/sse.js +0 -1
  95. package/src/handlers/stream.js +0 -1
  96. package/src/handlers/text.js +0 -1
  97. package/src/handlers/view.js +0 -1
  98. package/src/handlers/ws.js +0 -1
  99. package/src/init.js +0 -12
  100. package/src/public/load-text.js +0 -3
  101. package/src/public/loader.js +0 -30
  102. package/src/public/serve-asset.js +0 -9
  103. package/src/runtime/file.js +0 -3
  104. package/types/index.d.ts +0 -89
package/types/index.d.ts DELETED
@@ -1,89 +0,0 @@
1
- type RouteFunction = (request?: RequestFacade) => ResponseFacade;
2
-
3
- type App = any;
4
-
5
- interface MinOptions {
6
- status: number,
7
- headers: Headers | {},
8
- }
9
-
10
- interface ErrorOptions extends MinOptions {
11
- page: string,
12
- }
13
-
14
- interface Options extends ErrorOptions {
15
- placeholders: {},
16
- }
17
-
18
- type Dispatcher = {
19
- get(property: string): string,
20
- };
21
-
22
- type RequestFacade = {
23
- body: {}
24
- path: Dispatcher,
25
- query: Dispatcher,
26
- cookies: Dispatcher,
27
- headers: Dispatcher,
28
- original: Request,
29
- };
30
-
31
- type ResponseFn = (app: App, ...rest: any) => Response;
32
- type ResponseFacade =
33
- string
34
- | object
35
- | URL
36
- | Blob
37
- | ReadableStream
38
- | Response
39
- | ResponseFn;
40
-
41
- type Streamable = ReadableStream | Blob;
42
-
43
- declare module "primate" {
44
- export type Route = {
45
- get?: RouteFunction,
46
- post?: RouteFunction,
47
- put?: RouteFunction,
48
- delete?: RouteFunction,
49
- };
50
- }
51
-
52
- declare module "primate/handler/error" {
53
- export default function(body: string, options?: ErrorOptions): ResponseFn;
54
- }
55
-
56
- declare module "primate/handler/json" {
57
- export default function(body: {}, options?: MinOptions): ResponseFn;
58
- }
59
-
60
- declare module "primate/handler/redirect" {
61
- export default function(location: string, options?: MinOptions): ResponseFn;
62
- }
63
-
64
- declare module "primate/handler/sse" {
65
- export default function(implementation: {
66
- open?: () => void,
67
- close?: () => void,
68
- }, options?: MinOptions): ResponseFn;
69
- }
70
-
71
- declare module "primate/handler/stream" {
72
- export default function(body: Streamable, options?: MinOptions): ResponseFn;
73
- }
74
-
75
- declare module "primate/handler/text" {
76
- export default function(body: string, options?: MinOptions): ResponseFn;
77
- }
78
-
79
- declare module "primate/handler/view" {
80
- export default function(name: string, props: {}, options?: Options): ResponseFn;
81
- }
82
-
83
- declare module "primate/handler/ws" {
84
- export default function(implementation: {
85
- open?: () => void,
86
- close?: () => void,
87
- message?: (Event: unknown) => void,
88
- });
89
- }