@c9up/ream 0.2.18 → 0.2.19
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.
- package/README.md +4 -0
- package/dist/Application.d.ts +15 -0
- package/dist/Application.d.ts.map +1 -1
- package/dist/Application.js +15 -0
- package/dist/Application.js.map +1 -1
- package/dist/Provider.d.ts +15 -0
- package/dist/Provider.d.ts.map +1 -1
- package/dist/Provider.js.map +1 -1
- package/dist/http/Request.d.ts +13 -3
- package/dist/http/Request.d.ts.map +1 -1
- package/dist/http/Request.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/router/Router.d.ts +1 -1
- package/dist/router/Router.js +1 -1
- package/dist/security/CookieSigner.d.ts +3 -2
- package/dist/security/CookieSigner.d.ts.map +1 -1
- package/dist/security/CookieSigner.js +3 -2
- package/dist/security/CookieSigner.js.map +1 -1
- package/dist/storage/StaticMiddleware.d.ts +75 -7
- package/dist/storage/StaticMiddleware.d.ts.map +1 -1
- package/dist/storage/StaticMiddleware.js +257 -85
- package/dist/storage/StaticMiddleware.js.map +1 -1
- package/dist/storage/StaticProvider.d.ts.map +1 -1
- package/dist/storage/StaticProvider.js +12 -3
- package/dist/storage/StaticProvider.js.map +1 -1
- package/events.win32-x64-msvc.node +0 -0
- package/index.darwin-arm64.node +0 -0
- package/index.darwin-x64.node +0 -0
- package/index.linux-arm64-gnu.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +8 -8
- package/scheduler.win32-x64-msvc.node +0 -0
- package/scripts/copy-napi.mjs +11 -3
- package/src/Application.ts +15 -0
- package/src/Provider.ts +15 -0
- package/src/http/Request.ts +13 -3
- package/src/index.ts +3 -3
- package/src/router/Router.ts +1 -1
- package/src/security/CookieSigner.ts +3 -2
- package/src/storage/StaticMiddleware.ts +338 -97
- package/src/storage/StaticProvider.ts +14 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c9up/ream",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"description": "Ream — Rust-powered Node.js application framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -228,12 +228,12 @@
|
|
|
228
228
|
"tsconfig.client.json"
|
|
229
229
|
],
|
|
230
230
|
"dependencies": {
|
|
231
|
-
"file-type": "^22.0.
|
|
232
|
-
"reflect-metadata": "^0.2"
|
|
231
|
+
"file-type": "^22.0.2",
|
|
232
|
+
"reflect-metadata": "^0.2.2"
|
|
233
233
|
},
|
|
234
234
|
"peerDependencies": {
|
|
235
235
|
"@c9up/comet": "^0.1.0",
|
|
236
|
-
"@c9up/quasar": "^0.1.0",
|
|
236
|
+
"@c9up/quasar": "^0.1.0 || ^0.2.0",
|
|
237
237
|
"hot-hook": "^1.0.0"
|
|
238
238
|
},
|
|
239
239
|
"peerDependenciesMeta": {
|
|
@@ -250,12 +250,12 @@
|
|
|
250
250
|
"devDependencies": {
|
|
251
251
|
"@biomejs/biome": "2.5.12",
|
|
252
252
|
"@c9up/comet": "^0.1.0",
|
|
253
|
-
"@types/node": "^22.
|
|
254
|
-
"@vitest/coverage-v8": "
|
|
253
|
+
"@types/node": "^22.20.1",
|
|
254
|
+
"@vitest/coverage-v8": "4.1.11",
|
|
255
255
|
"mime-db": "^1.54.0",
|
|
256
256
|
"mime-types": "^3.0.2",
|
|
257
|
-
"typescript": "^6.0.
|
|
258
|
-
"vitest": "
|
|
257
|
+
"typescript": "^6.0.3",
|
|
258
|
+
"vitest": "4.1.11"
|
|
259
259
|
},
|
|
260
260
|
"engines": {
|
|
261
261
|
"node": ">=22.0.0"
|
|
Binary file
|
package/scripts/copy-napi.mjs
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// crate listed in `NAPI_CRATES` ships in the tarball.
|
|
22
22
|
|
|
23
23
|
import { copyFileSync, existsSync } from 'node:fs'
|
|
24
|
-
import { dirname, join } from 'node:path'
|
|
24
|
+
import { dirname, join, resolve } from 'node:path'
|
|
25
25
|
import { arch, env, platform } from 'node:process'
|
|
26
26
|
import { fileURLToPath } from 'node:url'
|
|
27
27
|
|
|
@@ -48,6 +48,14 @@ const HOST_SUFFIX_MAP = {
|
|
|
48
48
|
'win32-x64': 'win32-x64-msvc',
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
// Cargo writes its artifacts under CARGO_TARGET_DIR when that is set — a
|
|
52
|
+
// shared cache, a CI mount — so they are not under this package's `target/` at
|
|
53
|
+
// all. A relative value is resolved against the directory cargo ran in, which
|
|
54
|
+
// is this package root.
|
|
55
|
+
const targetDir = env.CARGO_TARGET_DIR
|
|
56
|
+
? resolve(root, env.CARGO_TARGET_DIR)
|
|
57
|
+
: join(root, 'target')
|
|
58
|
+
|
|
51
59
|
const triple = env.CARGO_BUILD_TARGET ?? ''
|
|
52
60
|
let suffix
|
|
53
61
|
let os
|
|
@@ -59,11 +67,11 @@ if (triple) {
|
|
|
59
67
|
}
|
|
60
68
|
suffix = entry.suffix
|
|
61
69
|
os = entry.os
|
|
62
|
-
releaseDir = join(
|
|
70
|
+
releaseDir = join(targetDir, triple, 'release')
|
|
63
71
|
} else {
|
|
64
72
|
suffix = HOST_SUFFIX_MAP[`${platform}-${arch}`]
|
|
65
73
|
os = platform
|
|
66
|
-
releaseDir = join(
|
|
74
|
+
releaseDir = join(targetDir, 'release')
|
|
67
75
|
if (!suffix) {
|
|
68
76
|
throw new Error(`[ream:napi] unsupported platform/arch: ${platform}-${arch}`)
|
|
69
77
|
}
|
package/src/Application.ts
CHANGED
|
@@ -73,6 +73,21 @@ export interface ReamrcContents {
|
|
|
73
73
|
export class Application implements AppContext {
|
|
74
74
|
readonly container: Container
|
|
75
75
|
readonly config: ConfigStore
|
|
76
|
+
/**
|
|
77
|
+
* Whether the inker template engine is installed (AdonisJS `usingEdgeJS`).
|
|
78
|
+
*
|
|
79
|
+
* Set by `InkerProvider`'s CONSTRUCTOR, so it is already true by the time any
|
|
80
|
+
* other provider boots. A package that wants to contribute to templates —
|
|
81
|
+
* rosetta pushing its `t()` global, say — reads this before importing
|
|
82
|
+
* `@c9up/inker`, and stays installable without it when the answer is no.
|
|
83
|
+
*
|
|
84
|
+
* A flag rather than a container lookup, and that is the whole point: the
|
|
85
|
+
* engine is a module singleton, so asking the container would mean resolving
|
|
86
|
+
* a binding whose lifecycle has to have reached the right phase. This answers
|
|
87
|
+
* the only question the caller actually has — is the package there — without
|
|
88
|
+
* one.
|
|
89
|
+
*/
|
|
90
|
+
usingInker = false
|
|
76
91
|
#appRoot?: URL
|
|
77
92
|
#directories: DirectoriesNode = { ...defaultDirectories }
|
|
78
93
|
#rcFile: ReamrcContents = {}
|
package/src/Provider.ts
CHANGED
|
@@ -32,6 +32,21 @@ export interface ConfigReader {
|
|
|
32
32
|
export interface AppContext {
|
|
33
33
|
container: Container
|
|
34
34
|
config: ConfigReader
|
|
35
|
+
/**
|
|
36
|
+
* Whether the inker template engine is installed — see
|
|
37
|
+
* `Application#usingInker`. Optional here because a host that is not ream
|
|
38
|
+
* satisfies this contract structurally and has no such flag; a provider
|
|
39
|
+
* reading it treats `undefined` as "no engine".
|
|
40
|
+
*/
|
|
41
|
+
usingInker?: boolean
|
|
42
|
+
/**
|
|
43
|
+
* Absolute path to the application's `public/` directory — see
|
|
44
|
+
* `Application#publicPath`. Optional for the same reason as the flag above:
|
|
45
|
+
* a host that is not ream satisfies this contract structurally and has no
|
|
46
|
+
* directory layout. A provider that needs it falls back to a relative
|
|
47
|
+
* `'public'`, resolved against the working directory.
|
|
48
|
+
*/
|
|
49
|
+
publicPath?(...paths: string[]): string
|
|
35
50
|
}
|
|
36
51
|
|
|
37
52
|
/**
|
package/src/http/Request.ts
CHANGED
|
@@ -384,9 +384,19 @@ export class Request extends Macroable {
|
|
|
384
384
|
* `defaultValue` (or null) when absent OR when the signature is invalid
|
|
385
385
|
* (tampered / not signed).
|
|
386
386
|
*
|
|
387
|
-
* NAMED DEVIATION — the fallback is `??`, where
|
|
388
|
-
*
|
|
389
|
-
*
|
|
387
|
+
* NAMED DEVIATION — the fallback is `??`, where upstream writes `||`
|
|
388
|
+
* (`@adonisjs/http-server@9.3.0`: `return this.#cookieParser.unsign(key) ||
|
|
389
|
+
* defaultValue`).
|
|
390
|
+
*
|
|
391
|
+
* The case that matters is the EMPTY STRING. A signed cookie carries a
|
|
392
|
+
* string — {@link Response.cookie} takes `value: string` — so `""` is the one
|
|
393
|
+
* falsy value this accessor can actually hold, and it is a value someone
|
|
394
|
+
* wrote, not an absence. `||` hands back the default for it; `??` does not.
|
|
395
|
+
*
|
|
396
|
+
* Upstream's own doc-comment on that line says the default is returned "when
|
|
397
|
+
* actual value is undefined" — which is what `??` does and `||` does not. So
|
|
398
|
+
* this follows the contract upstream documents, and differs only from what it
|
|
399
|
+
* happens to execute. Kept.
|
|
390
400
|
*/
|
|
391
401
|
cookie(name: string): string | null
|
|
392
402
|
cookie(name: string, defaultValue: string): string
|
package/src/index.ts
CHANGED
|
@@ -148,8 +148,8 @@ export { ApiResource } from './resources/ApiResource.js'
|
|
|
148
148
|
|
|
149
149
|
// ─── Static Files ───────────────────────────────────────────
|
|
150
150
|
|
|
151
|
-
export type { StaticConfig } from './storage/StaticMiddleware.js'
|
|
152
|
-
export { StaticMiddleware } from './storage/StaticMiddleware.js'
|
|
151
|
+
export type { DotFilesPolicy, StaticConfig } from './storage/StaticMiddleware.js'
|
|
152
|
+
export { defineStaticConfig, StaticMiddleware } from './storage/StaticMiddleware.js'
|
|
153
153
|
export type { StaticProviderOptions } from './storage/StaticProvider.js'
|
|
154
154
|
export { StaticProvider } from './storage/StaticProvider.js'
|
|
155
155
|
|
|
@@ -385,4 +385,4 @@ export {
|
|
|
385
385
|
StatsTracker,
|
|
386
386
|
} from './scheduler/index.js'
|
|
387
387
|
|
|
388
|
-
export const VERSION = '0.2.
|
|
388
|
+
export const VERSION = '0.2.19'
|
package/src/router/Router.ts
CHANGED
|
@@ -159,8 +159,9 @@ export class CookieSigner {
|
|
|
159
159
|
/**
|
|
160
160
|
* The cipher in use (AdonisJS `Encryption.algorithm`).
|
|
161
161
|
*
|
|
162
|
-
* `aes-256-gcm`,
|
|
163
|
-
*
|
|
162
|
+
* `aes-256-gcm`, which is what upstream configures by default now; the CBC
|
|
163
|
+
* construction lives on there as the `legacy` driver. See the note at the top
|
|
164
|
+
* of this file for what that means for a cookie written by an older app.
|
|
164
165
|
*/
|
|
165
166
|
get algorithm(): 'aes-256-gcm' {
|
|
166
167
|
return 'aes-256-gcm'
|